Need Help + Proxy

yafid

Newbie
Joined
Mar 11, 2013
Messages
8
Reaction score
1
hello , i need help to fix my script

PHP:
<?php
$id = $_GET[id];
$url=file_get_contents("........");
$proxy =  '............';
$proxyauth = '.............';

global $proxy;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_HEADER, 0); // return headers 0 no 1 yes
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return page 1:yes
curl_setopt($ch, CURLOPT_TIMEOUT, 200); // http request timeout 20 seconds
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects, need this if the url changes
curl_setopt($ch, CURLOPT_MAXREDIRS, 6); //if http server gives redirection responce
curl_setopt($ch, CURLOPT_USERAGENT,
    "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); // cookies storage / here the changes have been made
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // false for https
curl_setopt($ch, CURLOPT_ENCODING, "gzip"); // the page encoding

$data = curl_exec($ch); // execute the http request
curl_close($ch);

$x=explode("amp;",$data);
$t=array(); $g=array(); $h=array();
echo "<pre>\r\n";
foreach($x as $r){
    $c=explode("=",$r);
    $n=$c[0]; $v=$c[1];
    $y=urldecode($v);
    $t[$n]=$v;
}

print_r($t);
echo "\r\n</pre>";
?>

if i run this script, i've got error:
PHP:
CacheHost%3A%20sppchi4.chicago.il.us%0D%0AErrPage%3A%20ERR_INVALID_URL%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Thu,%2026%20Jun%202014%2020%3A23%3A48%20GMT%0D%0A%0D%0AClientIP%3A%20192.72.193.100%0D%0A%0D%0AHTTP%20Request%3A%0D%0A%0D%0A%0D%0A"

anyone can help me to fix this script, i want run this script + proxy
 
I think it's more like there is something wrong with the url you are trying to access instead of proxy problem.

Maybe you should start with something really simple like www.wikipedia.org

If this works, then it's likely to be your url which contains "special" characters like whitespace, &, etc which you need to encode
 
It's working here, I tested with the url http://google.com with a random HTTP proxy from a free proxy list.
I think the problem is the URL you are using.
 
ok thank, its work now
 
Back
Top