Solved

PHP Script that print .pdf links from a web page

Posted on 2009-04-08
11
348 Views
Last Modified: 2013-12-13
Can someone please help me to get this script working.   It will save me 30 minutes each Monday if can just get it working..

Please refer to this previous question post which is still open :

http://www.experts-exchange.com/Programming/Languages/Scripting/Q_24151725.html#a24094017

I get a parse error on line     curl_setopt($ch, CURLOPT_ USERPWD, $details);    
<?php
 
$url = "http://www.valueline.com/secure/vlispdf/stk1700/index.aspx";
$details = "xxxx:yyyy";
 
// create a new cURL resource
$ch = curl_init(); 
 
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_ USERPWD, $details);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
 // grab URL and pass it to the browser
$result = curl_exec($ch);
 
// close cURL resource, and free up system resources
curl_close($ch);
 
echo $result;
 
?>
 
 
 
 
 
 
 
<?php
$html_page_source = "http://www.valueline.com/secure/vlispdf/stk1700/current.aspx?issue=7";
 
preg_match_all('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]\.pdf/i', $html_page_source, $links);
 
foreach($links['0'] as $link)
{
//echo $link."<br>\n";
print $link."<br>\n";
}
 
?>

Open in new window

0
Comment
Question by:lblinc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24097333
you have a space
CURLOPT_ USERPWD
it should be
CURLOPT_USERPWD
0
 

Author Comment

by:lblinc
ID: 24097752
Ok, fixed that, thx.

But now I'm getting -->

PHP fatal error:  Call to underfined function curl_init()  in C:\php\PHP_Script.php  
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24098796
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:lblinc
ID: 24098979
Thanks,  I already did searches in Google..

which led me to uncomment line in PHP.ini file -->  

;extension=php_curl.dll  

to

extension=php_curl.dll


Now i get a new error :    

PHP Warning:  PHP Startup:  Unable to load dynamic library ' ./php_curl.dll'    -  The specified module could not be found.

0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24100444
Did you run
 <?php
phpinfo();
?>  

to see if curl is installed at all
0
 

Author Comment

by:lblinc
ID: 24100531
yes i did..    so what am i specifically looking for in all that config info?    i'd rather not post 200 lines of the output from running -->

<?php
phpinfo();
?>  

which i placed above lines inside a new  InfoPHP.php  file  and ran it as follows :

>    php -f InfoPHP.php

at this point..   i sort of wish someone would have just shown me a way to do what i need using Perl..
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24100708
If there is no mentioning of curl, it is not installed
0
 

Author Comment

by:lblinc
ID: 24103769
Curl dll is present there in my C:\php\ext

in the php.ini file  -->   i think i need to need to change the extension_dir from :

extension_dir = "./"

to

extension_dir = "./php/ext"
0
 

Author Comment

by:lblinc
ID: 24103889
This is solution, it has to be!   For running curl on Win XP..

http://www.webmasterworld.com/forum88/6176.htm
0
 

Author Comment

by:lblinc
ID: 24103916
unreal.    it still doesn't work.    is it really this impossible to install PHP and Curl properly?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24104373
I have no idea. I am on a linux host and it was already installed
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question