CURL question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Hesky
Forum Newbie
Posts: 2
Joined: Mon Dec 11, 2006 9:51 am

CURL question

Post by Hesky »

Hi,

I'm trying to use cURL to get the contents of a website.

I'm testing an example provided by godaddy (my host). Now for some reason it seems to work with every URL I've tested it with, except one (unfortunately, the one I need): http://www.whl.ca/hm/ <With this webpage all I get is a blank page (a timeout error I think).

Every other URL I have tested works justs fine.

Here's the code:

Code: Select all

<?

$URL="https://www.paypal.com";
if (isset($_GET["site"])) { $URL = $_GET["site"]; }
$ch = curl_init();
echo "URL = $URL <br>\n";
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
$result = curl_exec ($ch);
echo "<hr><br>\n";
echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>';
echo "<hr><br>\n";
curl_close ($ch);
print "result - $result";
echo "<hr><br>\n";

?>
Any help would be greatly appreciated...and sorry for my poor English.
Last edited by Hesky on Mon Dec 11, 2006 10:07 am, edited 4 times in total.
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

if you wrap your code round [ php ] code [ / php ] tags it will be easier to read by the members here
Hesky
Forum Newbie
Posts: 2
Joined: Mon Dec 11, 2006 9:51 am

Post by Hesky »

thiscatis wrote:if you wrap your code round [ php ] code [ / php ] tags it will be easier to read by the members here
Done, thanks and sorry.
Post Reply