How to use the proxies in PHP with cURL?

Q: How should I use the proxies with user and pass in PHP ?

A:

<?php
$ch = curl_init(“http://google.com”);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_PROXY, ‘IP:PORT’);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, ‘USER:PASS’);
$result = curl_exec($ch);
echo $result;
?>

Rate answer
[Total: 0    Average: 0/5]

Comments on this post

No comments.

It is necessary to login to write comment.

Trackbacks and Pinbacks on this post

No trackbacks.

TrackBack URL