Faire passer un script PHP par TOR
<br></br> function tor_wrapper($url){<br></br> $ua = array('Mozilla','Opera','Microsoft Internet Explorer','ia_archiver');<br></br> $op = array('Windows','Windows XP','Linux','Windows NT','Windows 2000','OSX');<br></br> $agent = $ua[rand(0,3)].'/'.rand(1,8).'.'.rand(0,9).' ('.$op[rand(0,5)].' '.rand(1,7).'.'.rand(0,9).'; en-US;)';``
# Adresse et port du TOR<br></br> $tor = '127.0.0.1:9050';<br></br> # Mettez un TimeOut<br></br> $timeout = '300';
<p> $ack = curl_init();<br></br> curl_setopt ($ack, CURLOPT_PROXY, $tor);<br></br> curl_setopt ($ack, CURLOPT_URL, $url);<br></br> curl_setopt ($ack, CURLOPT_HEADER, 1);<br></br> curl_setopt ($ack, CURLOPT_USERAGENT, $agent);<br></br> curl_setopt ($ack, CURLOPT_RETURNTRANSFER, 1);<br></br> curl_setopt ($ack, CURLOPT_FOLLOWLOCATION, 1);<br></br> curl_setopt ($ack, CURLOPT_TIMEOUT, $timeout);</p>
$syn = curl_exec($ack);<br></br> # $info = curl_getinfo($ack);<br></br> curl_close($ack);<br></br> # $info['http_code'];<br></br> return $syn;<br></br>
Et voici comment l’appeler dans vos scripts :
<br></br> $wrapped = tor_wrapper("https://korben.info");<br></br> echo $wrapped;<br></br>
Voilà… Je me dis que ça peut toujours dépanner…