public function changeProxyIdentity() {
$ip = '127.0.0.1';
$port = '9051';
$fp = fsockopen( $ip, $port, $error_number, $err_string, 10 );
if ( !$fp ) {
echo "Error while changing Tor proxy identity: {$error_number} : {$err_string}";
return false;
} else {
fwrite( $fp, "AUTHENTICATE\n" );
$received = fread( $fp, 512 );
fwrite( $fp, "signal NEWNYM\n" );
$received = fread( $fp, 512 );
curl_setopt( $this -> ch, CURLOPT_PROXY, $ip . ':' . $port);
}
sleep(1);
fclose( $fp );
return $received;
}
...
$ip = '127.0.0.1';
$port = '9051';
curl_setopt( $this -> ch, CURLOPT_PROXY, $ip . ':' . $port);
...