Knowledgebase / Customer Portal / How to get cryptocurrency price in your onion service?

How to get cryptocurrency price in your onion service?

For the sake of your onion service's security and protection, our Tor hosting by default doesn't permit your onion service to connect to any external services. This is because any request made to an external service could potentially expose your activity to a third party, compromising your privacy and anonymity.

However, if you need to make a request to an external service, you can adhere to the following guide. This guide will illustrate how your onion service can retrieve the price of cryptocurrency from a third-party service.

On our Customer Portal, click your Onion Service, and navigate to the "Network" tab.

On our Customer Portal, click your Onion Service, and navigate to the Network tab.

In the "Outbound Traffic" section, click "Enable Tor Relay". And you will see the success message when this feature is enabled.

In the Outbound Traffic section, click Enable Tor Relay. And you will see the success message when this feature is enabled.

When this feature is activated, you have the ability to use the Tor instance for making external requests. All requests originating from your onion service are confidential and anonymous, guaranteeing the security and protection of your onion service.

Then, you can try to execute the below PHP script. This script shows how to get cryptocurrency price from third party service.

<?php
$url = 'https://www.blockonomics.co/api/price?currency=USD';
$proxy = 'proxy:9050';
$timeout = 5;

$ch = curl_init();
if($ch === false) die('Failed to create curl object');

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
$content = curl_exec($ch);
curl_close($ch);

echo $content;
Tags:
  • Onion Service
  • Cryptocurrency
  • External Service

24/7 Expert Support

Our experts are always on hand to help answer your questions, get you started, and grow your presence online. You can email us any time