Saturday, October 31, 2009

PHP: Using curl with private proxies

Curl is a supper thing. You can do whatever you like. It has almost every functionality for your needs. I'm a fan of CURL.

Lets say you need to authenticate your proxy with a particular username and password. Using curl its just one single line of code. The below line will help you to connect to the proxy using authentication.

curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password");

Remember, the username and password are separated with colon(:).

Those who are new to proxy, here is the complete portion for proxy for your curl.

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, "192.179.1.32:808");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password");


Hope this will help you guys sometimes.

1 comment:

Faiza Shafi said...

This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. private proxies

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...