Reputation: 3
$response = Unirest\Request::get("https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/search?number=10&offset=0&query=burger",
array(
"X-Mashape-Key" => "__PRIVATE_KEY__",
"X-Mashape-Host" => "__REMOTE_HOST__"
)
);
Upvotes: 0
Views: 901
Reputation: 941
First we need to download unirest-php php library From this link https://github.com/Kong/unirest-php
Then next create php script and add unirest
<?php
require_once 'unirest-php/src/Unirest.php'; // here we add path of Unirest.php
$response = Unirest\Request::get("https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/search?number=10&offset=0&query=burger",
array(
"X-Mashape-Key" => "privatekey",
"X-Mashape-Host" => "spoonacular-recipe-food-nutrition-v1.p.mashape.com"
)
);
echo "<pre>";
print_r($response);
?>
When we run this code then we get following proper output in response
Now it's works perfectly
Happy Programming
Thanks, AS
Upvotes: 1