By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,353 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,353 IT Pros & Developers. It's quick & easy.

cURL connecting help

P: 1
I am using windows xp.

Hi, I am really new to cURL (started today) and funnily enough haven't even got it to output anything yet!

Anway my problem is when using the following code I always get an error number 7 which is "cURL error:Failed to connect to 209.249.24.13: Connection refused". I have tried this on plenty of websites and keep getting the same error with just different ip adresses. I am using WAMP5 Version 1.7.3 and have php_curl.dll enabled but still nothing working... here is the code:

[php]
<?php
$ch = curl_init();
$target_url = "http://hiscore.runescape.com/index_lite.ws?player=Lustful_Mage";
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$html = curl_exec($ch);
if (!$html) {
echo "<br />cURL error number:" .curl_errno($ch);
echo "<br />cURL error:" . curl_error($ch);
exit;
}
?>[/php]
Oct 28 '07 #1
Share this Question
Share on Google+
1 Reply


P: 93
What happens if you print $html?

Have you tried using fsockopen() to connect to another website? If fsockopen() works then you can assume that the problem is with curl, and if fsockopen doesn't work then it's more likely to be a problem with PHP's connection to the internet.
Oct 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.