Hi there, below is a little snippet of what using Proxy in PHP cURL
<?php
$loginpassw
= ''; //your proxy login and password here if any
$proxy_ip = '202.148.22.171'; //proxy IP here
$proxy_port = 80; //proxy port from your proxy list
$url = ''; //URL to get
//Lets initiate cURL
$ch = curl_init();
//Some useful things we need for it to work
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);
//Gather up every result in a variable
$data = curl_exec($ch);
//We are done, lets close connection
curl_close($ch);
//Show up your result
echo $data;
?>
No comments:
Post a Comment