QR-code and Barcode Scanner

FREEMIUM
Verified
Por PresentID | Atualizado 2 months ago | Machine Learning
Popularidade

9.2 / 10

Latência

384ms

Nível de serviço

100%

Voltar para todas as discussões

getting error: "Invalid Mashape Key" when using mashape with site2sms in php.

P
p.chavhan
5 years ago

My code is this:

<pre><?php

require_once ‘vendor/autoload.php’;
require_once ‘vendor/mashape/unirest-php/src/Unirest.php’;

uid="useridofsite2sms";uid="user id of site2sms"; phone=“phone number”;
msg="message";msg="message"; pwd=“password of site2sms”;

// These code snippets use an open-source library. http://unirest.io/php
Unirest\Request::verifyPeer(false);
response=Unirest\Request::get("https://site2sms.p.mashape.com/index.php?msg=response = Unirest\Request::get( "https://site2sms.p.mashape.com/index.php?msg=msg&phone=phone&pwd=pwd&uid=$uid",
array(
“Authorization” => “Basic ODgxNzM4ODE5NjpwcmF2ZWVuMjIwMA==”,
“X-Mashape-Key” => “my mashape key”,
“Accept” => “text/plain”
)
);

print_r($response);
?></pre>

When I am running this code I am getting following error:

<pre>Unirest\Response Object
(
[code] => 403
[raw_body] => {“message”:“Invalid Mashape Key”}
[body] => stdClass Object
(
[message] => Invalid Mashape Key
)

[headers] => Array
    (
        [0] => HTTP/1.1 403 Forbidden
        [Content-Type] => application/json
        [Date] => Sat, 25 Feb 2017 19:49:13 GMT
        [Server] => Mashape/5.0.6
        [X-Mashape-Proxy-Response] => true
        [Content-Length] => 33
        [Connection] => keep-alive
    )

)</pre>

I tried to find solution for this in PHP but didn’t get any solution. Please provide solution for this issue asap.

Thanks in advance…

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários
Avaliação: 4.8 - Votos: 12