Learning PHPinux

cURL behind proxy and all the heavy stuff…

Posted by: gf4e on: June 25, 2008

Had to find a way to get webpages through proxy, and cURL for PHP was very helpful. Soon I am going to post a script with a possibility to use a proxy or not. Such a learning tip from me for people that might look for the same thing. I also decided to use Smarty and MDB2 with its MySQL driver for my new website automated monitoring system primarily because the script itself was too small to show to anybody :D Even though everything works well, I did not even realize that I would need a normal design for it, which I have no idea where to get. Anyways, cURL proxy usage example soon.

5 Responses to "cURL behind proxy and all the heavy stuff…"

Hi, Do you have the script now?
I’ve been waitin’

Hey, is that for the curl sample? I left it on my old computer, but if you still need it and you can’t figure it out on your own, tell me I will type you an example piece of code. ;)

I want to connect to other sites through proxie. Please post example:)

pretty much there are a couple of options that allow to use proxy with curl.

curl_setopt($ch, CURLOPT_PROXY, “http://000.000.000.000:0000″);
curl_setopt($ch, CURLOPT_PROXYPORT, 0000);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, “xxx:xxx”);

the first one sets your proxy’s ip and port. the second one is just for the port, which is weird. the third one is for authorization with proxy.

for a manual and examples visit: http://ca.php.net/curl

also there is a way to do that through php sockets as well. if, for example, curl is not available.

Leave a Reply