07 Mar

Using PHP’s Curl functions behind a Proxy

Using PHP’s Curl functions even if the net is accessible only thru a proxy. This is the only way curl can be used if you use GoDaddy’s hosting.

ch = curl_init("http://rss.news.yahoo.com/rss/topstories");

curl_setopt(ch, CURLOPT_HEADER, false);
curl_setopt(ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(ch, CURLOPT_PROXY, "");
curl_setopt(ch, CURLOPT_PROXYPORT, 80);
//curl_setopt (ch, CURLOPT_PROXYUSERPWD, "username:password");

data = curl_exec (ch);

Leave a Reply

Your email address will not be published. Required fields are marked *