- Desde
- 9 Dic 2011
- Mensajes
- 514
hola alguien me pasa un ejemplo de curl proxy ya que e comprado un vpn y no puedo lograr conectar a la web que quiero ver con proxy no se si lo estoy haciendo mal
$proxies = array(); // Declaring an array to store the proxy list
// Adding list of proxies to the $proxies array
$proxies[] = '196.46.189.85'; // Some proxies require user, password, IP and port number
$proxies[] = '196.46.189.85';
// Choose a random proxy
if (isset($proxies)) { // If the $proxies array contains items, then
$proxy = $proxies[array_rand($proxies)]; // Select a random proxy from the array and assign to $proxy variable
}
$ch = curl_init('http://**********/'); // Initialise a cURL handle
// Setting proxy option for cURL
if (isset($proxy)) { // If the $proxy variable is set, then
curl_setopt($ch, CURLOPT_PROXY, $proxy); // Set CURLOPT_PROXY with proxy in $proxy variable
}
$user = "******";
$pass = "********";
echo $proxy;
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$pass);
//curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "user-proxy:user-pass");
$results = curl_exec($ch);
curl_close($ch); // Closing the cURL handle
echo $results;
$proxies = array(); // Declaring an array to store the proxy list
// Adding list of proxies to the $proxies array
$proxies[] = '196.46.189.85'; // Some proxies require user, password, IP and port number
$proxies[] = '196.46.189.85';
// Choose a random proxy
if (isset($proxies)) { // If the $proxies array contains items, then
$proxy = $proxies[array_rand($proxies)]; // Select a random proxy from the array and assign to $proxy variable
}
$ch = curl_init('http://**********/'); // Initialise a cURL handle
// Setting proxy option for cURL
if (isset($proxy)) { // If the $proxy variable is set, then
curl_setopt($ch, CURLOPT_PROXY, $proxy); // Set CURLOPT_PROXY with proxy in $proxy variable
}
$user = "******";
$pass = "********";
echo $proxy;
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$pass);
//curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "user-proxy:user-pass");
$results = curl_exec($ch);
curl_close($ch); // Closing the cURL handle
echo $results;