Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 #87

Closed
garrylachman opened this issue Dec 12, 2015 · 5 comments
Closed

403 #87

garrylachman opened this issue Dec 12, 2015 · 5 comments

Comments

@garrylachman
Copy link

Always get 403 error, its works with CURL but Unirest is not working
i try from CLI and from WebServer

here is the code:
$response = Unirest\Request::post("https://community-neutrino-ip-info.p.mashape.com/ip-info",
array(
"X-Mashape-Key" => "XXXX",
"Content-Type" => "application/x-www-form-urlencoded",
"Accept" => "application/json"
),
array(
"ip" => "5.29.224.80",
"reverse-lookup" => true
)
);

@ahmadnassri
Copy link
Contributor

this is now fixed in v3.0.0

PLEASE NOTE: v3.0.0 introduces API changes, please review the release notes and README for details

@ghost
Copy link

ghost commented Feb 27, 2016

I don't know if it's fixed ... tested with version 3.0.0 of the lib and getting always 403 forbidden errors for Mashape :

require_once 'vendor/autoload.php';

global $url;
$url = $_GET['url'];


$response = Unirest\Request::post("https://savedeo.p.mashape.com/download",
  array(
    "X-Mashape-Key" => "KEY",
    "Content-Type" => "application/x-www-form-urlencoded",
    "Accept" => "application/json"
  ),
  array(
    "url" => urlencode($url)
  )
);

Any idea ??

@ghost
Copy link

ghost commented Feb 27, 2016

Ok... didn't read the new README ...

works with :

global $url;
$url = $_GET['url'];


$data =   array(
    "url" => $url
  );

$body = Unirest\Request\Body::form($data);

$response = Unirest\Request::post("https://savedeo.p.mashape.com/download",
  array(
    "X-Mashape-Key" => "KEY",
    "Content-Type" => "application/x-www-form-urlencoded",
    "Accept" => "application/json"
  ),
  $body
);

echo $response;

@ahmadnassri
Copy link
Contributor

awesome 👍

@sonicaghi
Copy link
Member

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants