Jump to content

PHP CURL


wpt394

Recommended Posts

I do'nt understand the difference between see something and get information from it....In the end I just want the html code of a https:// site.  I will eventually be doing preg_matches on it, but that's down the road.  All I need right now is help connecting to a https:// url (i.e. https://www.verisign.com) using curl.

Link to comment
https://forums.phpfreaks.com/topic/58899-php-curl/#findComment-292245
Share on other sites

a https:// site would suggest the data on it has a certain level of security needed for it and it is only viewable with a login of some sorts, curl is like fopen for urls. so you *shouldn't have an issue opening any url even on a ssh server if you do try saying

 

curl($site) or die ('CURL FAILED');

Link to comment
https://forums.phpfreaks.com/topic/58899-php-curl/#findComment-292326
Share on other sites

It is quite a bit more complicated that it seems.  Trust me, I've spent a couple days pouring over the internet looking for a solution.  I'm starting to think that it might be an issue with my webhost?  I'm not sure...  the website https://www.verisign.com doesn't require a login/password at all...Here is the code I've been using to try to connect to it...


$url = 'https://www.verisign.com/';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$result=curl_exec ($ch);
echo curl_error($ch);
echo ' '.curl_errno($ch);
curl_close ($ch);

   echo("<br>Results: <br>".$result);
  

 

This comes up with the "error 7: could not connect to www.verisign.com IP 1 Permission Denied"

 

Additionally, I've tried connecting to other 'https' urls, and receive the exact same error....Any help would be appreciated..

 

Link to comment
https://forums.phpfreaks.com/topic/58899-php-curl/#findComment-292331
Share on other sites

just out of curiosity have you tried to use different ports? I know https goes via a different port than 80 (i think), but that might be your issue.  Also the second part could be involved in a server side (on the ssh server) baubblefish key or something in which you HTTP_SERVER has to be LOCALHOST or block and you have to have the access key somehow to CURL it. 

Link to comment
https://forums.phpfreaks.com/topic/58899-php-curl/#findComment-292335
Share on other sites

I have not tried changing ports, but I'm not sure how I would go about doing that, or how I would go about determining which port to try...  I am using php on a webhost, and would be interested to know if anyone running their own apache server w/curl module could test out the script... 

 

p.s. Thanks JP128, but I am only using https://www.verisign.com as an example of a https:// site...I should have been more clear.

Link to comment
https://forums.phpfreaks.com/topic/58899-php-curl/#findComment-292345
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.