can somebody please clear the error ?

1 replies
hello. i am not getting the webpage loaded using proxy. can some one please find the bug in it.


$proxies = array(); // Declaring an array to store the proxy list
$url = "http://www.quora.com";

// Adding list of proxies to the $proxies array
$proxies[] = '109.73.70.165:5005'; // Some proxies require IP and port number
$proxies[] = '198.148.112.46:7808';

// 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(); // 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
}

// Set any other cURL options that are required

curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);

$results = curl_exec($ch); // Execute a cURL request
curl_close($ch); // Closing the cURL handle
#clear #error
  • Profile picture of the author Karen Blundell
    If there's a problem with this site you can send a message to the Help desk
    Signature
    ---------------
    {{ DiscussionBoard.errors[9262699].message }}

Trending Topics