Crypto-Loot / cryptoloot

Self Hosted Library for CryptoLoot
https://crypto-loot.com
55 stars 16 forks source link

API problem #7

Open engr-Eghbali opened 5 years ago

engr-Eghbali commented 5 years ago

Hi. I used cryptoloot HTTP API like:

https://api.crypto-loot.com/user/balance?name=1256****156&secret=66f5610f5533e9bf****************e84891528dd0 and its responded :{ "success": "false", "error": "invalid_secret" }

I copied "exact" key from dashboard. whats wrong?

Nalem14 commented 5 years ago

Send a POST request, don't use GET request.

engr-Eghbali commented 5 years ago

@FlyingBlue Thanks for your response but cryptoloot documentation said Method: GET. By the way I tried with 'POST' method and there is no success cause of CORS policy error appeared.

Access to XMLHttpRequest at 'https://api.crypto-loot.com/user/balance' from origin 'http://miner22.dx.am' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Nalem14 commented 5 years ago

Yes, but is POST.... the documentation said wrong method... Don't make post request in Javascript, you have a problem with the Origin of the request that is not allowed on other website by a client (js).

Make PHP post request.

<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://api.crypto-loot.com/user/balance");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('name' => 'user1', 'secret' => 'b1349*****')));

// Receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec($ch);

curl_close ($ch);

// Further processing ...
print_r($server_output);
?>
engr-Eghbali commented 5 years ago

@FlyingBlue Appreciate for your help, it finally worked ! but there is something so strange! I received response after 3.6 minutes ! why so long?! how is this possible?!

Nalem14 commented 5 years ago

Your welcome ;-)

I don't know, I don't have that problem. Do you make local test or Server production test ?

engr-Eghbali commented 5 years ago

@FlyingBlue This is server production test, I made a ticket and waiting for support, its unusual .