Advanced Onion Router - install successfully and connected but my ip address did not change - tor

I have downloaded and installed Advanced Onion Router (AdvOR-0.3.0.20) on Windows 7 successfully, I have made it connected also. But after that, I see my ip address did not change, also I checked at check.torproject.org by both firefox and chrome return "not using tor".
Did I make anything wrong?
Regards,
Tin

With the helps from the nice guys, I have found the solution with my case.
I using PHP curl with Socks5 as the following:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0");
curl_setopt($ch, CURLOPT_HEADER, false);
if (!empty($cookie)) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// using TOR proxy
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:9050");
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
$contents = curl_exec($ch);
curl_close($ch);
It's success, because when I check $url = 'https://check.torproject.org', the content of html has a text:
'Congratulations. This browser is configured to use Tor. '
Cheers!!

You need to use the download from this link at the Tor Project's website. That should get you running Tor properly on Windows without any trouble.

Related

Azure: Get TTS File with Curl -Cognitive Speech

How do I get a correct TTS Response back, with an audio file?
The token works, but the TTS request not!
{"code":"404","message": "Resource not found"}
For the Token iam using this URL: https://westeurope.api.cognitive.microsoft.com/sts/v1.0/issuetoken
i found this Code Example on Azure this site, but its not working :-/ (https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-text-to-speech#sample-request-1)
$token=getToken();
$cont="<speak version='1.0' xml:lang='en-US'><voice xml:lang='en-US' xml:gender='Male'
name='en-US-ChristopherNeural'>
Microsoft Speech Service Text-to-Speech API
</voice></speak>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://westeurope.api.cognitive.microsoft.com/cognitiveservices/v1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($cont));
$headers = array();
#$headers[] = 'Ocp-Apim-Subscription-Key: xxxxxxxxxxxx';
$headers[] = 'X-Microsoft-OutputFormat: raw-24khz-16bit-mono-pcm';
$headers[] = 'Content-Type: application/ssml+xml';
#$headers[] = 'Host: westus.tts.speech.microsoft.com';
$headers[] = 'Content-Length: '.strlen($cont);
$headers[] = 'Authorization: Bearer '.$token;//Token okay
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
print_r($result); //{"code":"404","message": "Resource not found"}
OK, now it works,
i put the option curl_setopt($ch, CURLOPT_HEADER, 1);
to get some more information about the response, and it shows me this error
Required header User-Agent missing.
so i add one more headerParameter to it and now it works:
$headers[] = 'User-Agent: myApp/1.0.0';

Connection to Amazon Selling Partner API with curl

I have to add more details in my question, so here is my try to get orders from my seller central account:
$host = 'sellingpartnerapi-na.amazon.com'; // is this the right URL for REST API to get Orders from my seller central account?
$accessKey = 'AK...YOX.........';
$secretKey = 'K...........';
$region = 'us-east-1';
$service = 'execute-api';
$requestUrl = 'https://sandbox.sellingpartnerapi-na.amazon.com/orders/v0/orders'; // '<full url>';
$uri = '/orders/v0/orders'; // '<method path>';
$httpRequestMethod = 'GET'; // '<http verb>';
I used this sample files: https://github.com/avi-wish/aws4-signature-php
unfortunately there is no example URL for variable $host
If I test the connection, this is my response:
Response:403
{
"errors": [
{
"message": "Access to requested resource is denied.",
"code": "Unauthorized",
"details": "Access token is missing in the request header."
}
]
}
I found a possible solution here:
https://github.com/amzn/selling-partner-api-docs/issues/52#issuecomment-713522351
but it's not working for me.
Is that necessary to create a IAM User before? Here is the way I created it:
https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-your-selling-partner-api-application
I think a lot of people have the same problem. Hope someone can give me a hint.
after getting the access token, the curl return the error :
[message] => Access to requested resource is denied. [code] => MissingAuthenticationToken
function get_orders(){
$this->host = 'https://sellingpartnerapi-na.amazon.com/orders/v0/orders';
debug('>>get list of orders');
$data = "x-amz-date&access_token={$this->access_token}";
$curl = curl_init($this->host . '/orders/v0/orders');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json;charset=UTF-8')
);
$result = curl_exec($curl);
curl_close($curl);
$obj = json_decode($result,true);
debug($obj);
}
Unfortunately you give very little information about what you want to do. There are two ways to authorize the SP-API that is set via the grant-type.
I suppose you want to authorize yourself and not a vendor.
Then you have to send your request to the following endpoint:
api.amazon.com/auth/o2/token
You have to specify the $host with api.amazon.com.
The request method will be POST.
You pass the parameters to the http Body:
grant_type, refresh_token, client_id, client_secret
Please have a look at the following link:
Connecting to the Selling Partner API
After you have done all this the same way, you will get the following answer:
{
"access_token":"Atza|IwEBIJR-9fxxxxxxxxxxxxxxxxxxxxxx",
"refresh_token":"Atzr|IwEBIxxxxxxxxxxxxxxxxxxxxxxxx",
"token_type":"bearer",
"expires_in":3600
}
Now you can use the access_token to sign your requests.
In the following, I also recommend you to use my post from another answer to sign a request and successfully send a request.
Answer: 64858116
public function GetAcessToken()
{
$RefeshToken = $this->RefreshToken;
$data = "grant_type=refresh_token"
."&refresh_token=". $RefeshToken
."&client_id=".$this->ClientID
."&client_secret=".$this->ClientSecret;
$curl = curl_init($this->UrlForAmazonToken);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded;charset=UTF-8')
);
$result = curl_exec($curl);
curl_close($curl);
$obj = json_decode($result,true);
$this->AccessToken = $obj['access_token'] ;
return $this->AccessToken;
}
It works for me.

Sorry, this page isn't available in instagram

I am having difficulty in getting the latest post in Instagram.
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$result = fetchData("https://api.instagram.com/v1/users/{clientid}/media/recent/?access_token={accesstoken}&count=3");
$result = json_decode($result);
But I get the message like this:
Sorry the page is not available. The link you followed may be broken,
or the page may have been removed.
Usually happens if you have username instead of user-id in the API url
you have {clientid}, what is the value?, it should be user-id not a username, and definitely not your app's client-id, it should be all numbers.
You can get user-id by using the users/search URL
https://api.instagram.com/v1/users/self/?access_token={Access_token}
API to search for a username and get the corresponding user-id that matches the username you searched in the API response.

Instagram API Enforce Signed Requests Signature Does Not Match Error

Instagram Documentation: https://instagram.com/developer/secure-api-requests/
Goal: Comply with the [now mandatory] Enforce Signed Requests feature using Instagram API.
Functional issue: without compliance IG Like limits are 30 per hour. Complying allows for 100 Likes per hour
Technical issue: The following error is returned when making a simple call to the API for media:
{"code": 403, "error_type": "OAuthForbiddenException", "error_message": "Invalid signed-request: Signature does not match"}
Instagram Client Set Up: Client ID, Client Secret, Redirect URI have all been verified to match those used in all portions of the PHP code. Both "Disable implicit OAuth" and "Enforce signed requests" are checked.
Code Explanation: Three distinct pieces of code are needed to create the handshake with IG: 1. Header 2. Access Token [i.e. "access_token"] 3. Call with Sig [i.e. "sig" - not to be confused with "signature"]. I have confirmed that the same client_id, client_secret and access_token are used throughout all pieces of code. NOTE: Parts 1 and 2 work[ed] fine prior to the mandatory compliance. They still work fine, but I only get 30 Likes/hr [i.e. the main functional issue]
Header Code:
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$this->signature = $ip .'|'. hash_hmac('sha256', $ip, $this->settings['client_secret'], false);
Access Token Code, which returns successfully with an array similar to {"access_token":"11deadbee7.7dded5e.c0d656eead134218beef31a61b45e4d9",...}
$apiData = array(
'grant_type' => 'authorization_code',
'client_id' => $this->getApiKey(),
'client_secret' => $this->getApiSecret(),
'redirect_uri' => $this->getApiCallback(),
'code' => $code
);
$ch = curl_init();
$xHeaderFront = 'X-Insta-Forwarded-For:';
$xHeader = $xHeaderFront.$this->signature;
curl_setopt($ch, CURLOPT_URL, $apiHost);
curl_setopt($ch, CURLOPT_POST, count($apiData));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$jsonData = curl_exec($ch);
curl_close($ch);
Call with Sig. This returns the error {"code": 403, "error_type": "OAuthForbiddenException", "error_message": "Invalid signed-request: Signature does not match"}:
$params = array(); //temporary to force a simple set of parameters
$params['count']=10;
$params['access_token'] = $this->getAccessToken(); //11deadbee7.7dded5e.c0d656eead134218beef31a61b45e4d9 masked, but kept for ease of comparison]
$endpoint = '/media/657988443280050001_25025320'; //temporary
$sig = $endpoint;
ksort($params);
foreach ($params as $key => $val) {
$sig .= "|$key=$val";
}
$enforcedSig = hash_hmac('sha256', $sig, $secret, false);
$apiCall = 'https://api.instagram.com/v1/media/657988443280050001_25025320/likes?sig='.$enforcedSig.'&count=10&access_token='.$params['access_token'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiCall);
$xHeaderFront = 'X-Insta-Forwarded-For:';
$xHeader = $xHeaderFront.$this->signature;
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json',$xHeader));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$jsonData = curl_exec($ch);
curl_close($ch);
Your $endpoint seems to be wrong.
Add "/likes".
$endpoint = '/media/657988443280050001_25025320/likes'; //temporary

PayPal "Security header is not valid" error. What to do with this?

I am using PayPal's DoDirectPayment API for payment integration. I am getting an error message like below.
Security error:
Error no: 10002
Error message: Security header is not valid
Here is my code,
$environment = 'sandbox';
// Set up your API credentials, PayPal end point, and API version.
$API_UserName = urlencode('xxxxxxxx');
$API_Password = urlencode('xxxxxxxx');
$API_Signature = urlencode('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
$API_Endpoint = "https://api-3t.paypal.com/nvp";
if("sandbox" === $environment || "beta-sandbox" === $environment) {
$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
}
$version = urlencode('51.0');
// setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// Set the curl parameters.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
// Set the API operation, version, and API signature in the request.
$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
// Get response from the server.
$httpResponse = curl_exec($ch);
Please help me out from this problem.
Thanks.
goto https://developer.paypal.com/developer/accounts
login
create a Business account
click on the business account, click profile, click API Credentials and use the to access the api https://api-3t.sandbox.paypal.com/nvp
Be sure to check your API endpoint and version very carefully:
https://developer.paypal.com/webapps/developer/docs/classic/api/endpoints/
My problem occurred due to api credentials being incorrect. Even after entering the correct sandbox api username, password and api key, I still got the same error. I recreated my test accounts, entered them into my app again, restarted the server, and it worked.
Here's a link from x.com talking about a similar issue: paypal security header issue
you should change your Endpoint api.sandbox.paypal.com, it worked on me
First you login to account sendbox and check in tab application
user2230647 is right. You need to have sandbox information for all the following parameters in case you want to test in sandbox mode:
'api_endpoint' => 'https://api-3t.sandbox.paypal.com/nvp',
'api_username' => 'example_api1.email.com',
'api_password' => 'your_password',
'api_signature' => 'your_signature',

Resources