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.
Ben at 28 May, 2008 11:32
http://proxy.shr.secureserver.net:3128 works the best. Don't use IP address. GoDaddy uses different IP addresses for different hosting accounts.
Reply to this.
Liz at 04 Jun, 2008 02:21
Hi - Thanks for posting - saved me time researching! The godaddy article is help.godaddy.com/article/289 ...
Reply to this.
Reliance Insider at 22 Jul, 2008 02:26
Thanks Dude! You saved my day. I have been trying to setup stock quote plugin since long but could not due to cURL issue. Thanks for help.
Reply to this.
NickNeeck at 05 Aug, 2008 04:57
if i want to use it with a server and not a url, what to do?

THX!
Reply to this.
Anonymous at 22 Oct, 2008 10:45
Update From GoDaddy's Support Pages:

Proxy servers are not required for outbound shared hosting connections as of September 10, 2008. Although it will continue to function after this date, we recommend code utilizing proxy servers be updated to reflect this change.
Reply to this.
Anonymous at 16 Feb, 2009 09:44
Hi,
Thanks for good information,
This does help us a Lot in our Crawling Work.

<a href="http://ScrappingExpert.com">ScrappingExpert.com</a>
Reply to this.
digiwebtools at 07 May, 2009 06:30
Hi,
I am trying to connect to outbound whois port 43 and seems to be refused by Goddady.
Is there any way to connect via proxy likes this?
Thanks.
Reply to this.
Comment

Please dont enter you comments in this form - this is a fake form to confuse spamming bots. The next form is the real one.




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