PHP curl with proxy

Here is a simple PHP code snippet requesting given URL using curl and HTTP proxy server.

$loginpassw = 'login:password';  //your proxy login and password here
$proxy_ip = '127.0.0.1'; //proxy IP here
$proxy_port = 8080; //proxy port from your proxy list
$url = 'http://yahoo.com'; //URL to get

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0); // no headers in the output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $loginpassw);
$data = curl_exec($ch);
curl_close($ch);

echo $data;