I get the following error:
HTTP ERROR 500
Problem accessing /api/api. Reason:
Problem while creating output
Powered by Jetty://
When I use your example code:
require_once ‘./unirest-php/lib/Unirest.php’;
$response = Unirest::get(
“https://siri.p.mashape.com/api?input=who created you&timeZone=%2B120&locale=en&page=1&location=53.0%2C9.0&clientFeatures=all”,
array(
“X-Mashape-Authorization” => “QyDwbJaIk9hpLkaeNzbDI2OgfClZ7C4y”
),
null
);
echo $response->raw_body;
Participez à la discussion - ajoutez un commentaire ci-dessous:
Sorry for the very late reply!
It seems like indeed the auto-generated PHP code is broken, we will report this issue to mashape.
In the meantime this code should work for you:
<?
require_once ‘./unirest-php/lib/Unirest.php’;
function download($url)
{
ch=curlinit();curlsetopt(ch, CURLOPT_URL, url);curlsetopt(ch, CURLOPT_HTTPHEADER, array("X-Mashape-Authorization: ". “QyDwbJaIk9hpLkaeNzbDI2OgfClZ7C4y”));
responseBody=curlexec(ch);
curl_close($ch);
return $responseBody;
}
url = "https://jeannie.p.mashape.com/text/?input=Howdy&locale=en&location=50.3%2C9.0&clientFeatures=all&timeZone=%2B120&out=simple"; response = download($url);// OK
// response=Unirest::get(url, array( “X-Mashape-Authorization” => “QyDwbJaIk9hpLkaeNzbDI2OgfClZ7C4y” ), null ); // BROKEN!?
echo $response->raw_body;
?>