So I'm trying to cURL to an onion site, e.g: facebookcorewwwi.onion I would have the following code:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($curl, CURLOPT_URL, 'http://facebookcorewwwi.onion/');
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_HTTPGET, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_PROXY, '127.0.0.1:9050');
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
$html = curl_exec($curl);
var_dump($html);
This gives the following output:
bool(false)
yet this is not what I want as a result, I want the actual page content!
inb4: yes I have the tor browser open
curl_error gives the following error:
Error: Failed to connect to 127.0.0.1 port 9050: Connection refused
Tor browser by default uses port 9150 for SOCKS, where the default for the Tor daemon on Linux or the Expert Bundle on Windows is 9050.
If you change to port 9150 you should successfully be able to relay through Tor.