summaryrefslogtreecommitdiff
path: root/app/Console/Commands/TestTor.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Console/Commands/TestTor.php')
-rw-r--r--app/Console/Commands/TestTor.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/app/Console/Commands/TestTor.php b/app/Console/Commands/TestTor.php
new file mode 100644
index 0000000..87f0050
--- /dev/null
+++ b/app/Console/Commands/TestTor.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Http;
+
+class TestTor extends Command
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'test:tor { onion }';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Testing tor';
+
+ /**
+ * Create a new command instance.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * Execute the console command.
+ *
+ * @return mixed
+ */
+ public function handle()
+ {
+ $url = $this->argument('onion');
+
+ $response = Http::get($url);
+ dd($response->body());
+
+ // $url = 'http://jhiwjjlqpyawmpjx.onion/'; // Note the addition of a semicolon.
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:9150"); // Note the address here is just `IP:port`, not an HTTP URL.
+ curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); // Note use of `CURLPROXY_SOCKS5_HOSTNAME`.
+ $this->info("about to run");
+ $output = curl_exec($ch);
+ $this->info("run");
+
+ $curl_error = curl_error($ch);
+ curl_close($ch);
+
+ print_r($output);
+ print_r($curl_error);
+
+ return Command::SUCCESS;
+ }
+
+}