I'm trying to get Unirest working on my Laravel 4.0 framework.
Right now I'm using REST Countries v1 API and I'm having this issue while trying to get all countries: http://i.gyazo.com/3876755ebdf9b3e71c03a0e801975053.png if I remove the authorization, it returns a normal response saying to authorize but as soon as I authorize and try to get all countries it throws the whole mashape website on my localhost page.
<?php
Unirest::verifyPeer(false);
$response = Unirest::get(
"https://restcountries-v1.p.mashape.com", // This should return ALL the countries
array(
"X-Mashape-Authorization" => "secret-code"
),
null
);
?>
{{ $response->raw_body }} // echo $response->raw_body
But when I try to get by country code, it works like expected
<?php
Unirest::verifyPeer(false);
$response = Unirest::get(
"https://restcountries-v1.p.mashape.com/alpha/ru", // This should return only russia
array(
"X-Mashape-Authorization" => "secret-code"
),
null
);
?>
{{ $response->raw_body }} //echo $response->raw_body
http://i.gyazo.com/72017ce438f91cab8c9b16c50bba12d3.png
Why doesn't the first code example work but rather echo the whole Mashape website??