[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

PHP Script that print .pdf links from a web page

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
lblinc
Asked:
lblinc
  • 6
  • 5
1 Solution
 
Michel PlungjanIT ExpertCommented:
you have a space
CURLOPT_ USERPWD
it should be
CURLOPT_USERPWD
0
 
lblincAuthor Commented:
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
 
Michel PlungjanIT ExpertCommented:
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lblincAuthor Commented:
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
 
Michel PlungjanIT ExpertCommented:
Did you run
 <?php
phpinfo();
?>  

to see if curl is installed at all
0
 
lblincAuthor Commented:
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
 
Michel PlungjanIT ExpertCommented:
If there is no mentioning of curl, it is not installed
0
 
lblincAuthor Commented:
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
 
lblincAuthor Commented:
This is solution, it has to be!   For running curl on Win XP..

http://www.webmasterworld.com/forum88/6176.htm
0
 
lblincAuthor Commented:
unreal.    it still doesn't work.    is it really this impossible to install PHP and Curl properly?
0
 
Michel PlungjanIT ExpertCommented:
I have no idea. I am on a linux host and it was already installed
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now