Curl Function in GoDaddy Hosting

I use GoDaddy Hosting for this site. A few days ago I tried to use the curl library. Curl was there - but all my calls timed out. I tried different approaches - but all failed. After some google searches I found out why - GoDaddy is using a proxy server.

So if you are using GoDaddy hosting and what to use curl, you should include these lines in the script...


<?php
curl_setopt
($chCURLOPT_PROXYTYPECURLPROXY_HTTP);
curl_setopt($chCURLOPT_PROXY,"http://64.202.165.130:3128");

...assuming that $ch is the curl handle.

A full example...


<?php
$url 
"http://www.google.com/";

$ch curl_init();
curl_setopt ($chCURLOPT_URL$url);
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
curl_setopt ($chCURLOPT_PROXYTYPECURLPROXY_HTTP);
curl_setopt ($chCURLOPT_PROXY,"http://64.202.165.130:3128");
curl_setopt ($chCURLOPT_TIMEOUT120);
$response curl_exec ($ch);
if(
is_int($response)) {
    die(
"Errors: " curl_errno($ch) . " : " curl_error($ch));
}
curl_close ($ch);

print 
"Remote Site : $url<br /><hr />$response";
?>

Read more about using curl at the GoDaddy support pages...

Comments

Gladwin at 03 Apr, 2007 07:30
hi binny,
eda monae yu discovered that too..

hmm i just missed 2 mins .

Reply to this.
Nathan W. at 21 Jun, 2007 05:42
Thanks for this post; it helped with a site I'm developing on GoDaddy!
Reply to this.
Anonymous at 04 Jul, 2007 11:12
thanks for help.

presently the proxy server address looks like its:

http://proxy.shr.secureserver.net:3128
Reply to this.
Matt zammit at 30 Aug, 2007 07:03
I've been trying to find this solution for a whole week playing around with settings and stuff.
you're the man! kudos to you!
really thanks for this.
Reply to this.
Taylor C at 10 Oct, 2007 04:07
You're most definitely the man. I too have just spent a week trying to figure that out.
Reply to this.
Anonymous at 13 Nov, 2007 04:29
you rock thanks
Reply to this.
Thomas at 05 Jan, 2008 01:09
Sorry for the extremely newb question, but WHERE do I put the above code? I am running a LINUX - SHARED server via GoDaddy.

Do I create a curl.php file with the above code and upload it to my root directory on my server?
or
Do I edit the php.ini files?
or
Do I do something else?

I have been doing much research on this issue as I am having issues using a UPS module on my e-commerce website.
UPS requires an SSL certificate (Check) and Curl.

I am using a GoDaddy shared hosting account with no help from GoDaddy. Thank you for your time and information in advance. :)
Reply to this.
Binny V A at 05 Jan, 2008 02:49
This code should be placed in the PHP file which contains the code to access an external URL.
Reply to this.
Brad at 15 Mar, 2008 01:42
Sorry, but IMHO this is just another of the many reasons NOT to use GoDaddy for hosting.

Other then that I'm really liking your stuff ;-)

My hat's off to you for finding a solution to this situation.
Reply to this.
Ben at 09 May, 2008 09:57
You saved the day with this posting. That referenced GoDaddy article doesn't even exist anymore.
Reply to this.
Comment


Comment




Comment Formating : HTML tags a, strong, em, b, i, code, pre, p and br allowed. Other tags will be shown as code(< will become &lt;). Urls, Line breaks will be auto-formated.
Subscribe to Feed