Hey guys, I am Freek! I am currently studying creative technology and I have to make a website in php for a project. But I am stuck now. I use the API form recipepuppy.com and I want to parse the json from the site. That is all going well, but I want to alternate three arrays. Do one of you guys know how to do that? Thanks in advance!!
Here's what I have now.
<?php
require ('core/init.php');
//$x = DB::getInstance()->query("SELECT * FROM history WHERE user_id = ?", array(6))->results();
$i = 'onions, garlic';
$json = file_get_contents('http://www.recipepuppy.com/api/?i=' . $i);
$a = json_decode($json);
//print_r($x);
//echo '<br><br><br>';
//print_r($a);
foreach($a->results as $recipe){
$x = str_replace('Recipe', ' ', $recipe->title);
echo $x . '<br>';
}
foreach($a->results as $link){
echo $link->href .'<br>';
}
foreach($a->results as $image){
"<img src =\""echo $image->thumbnail ."\" width=\"300px\"alt =\"\"/><br>";
}
?>
But what I want is one image, with the recipe name and link next to it. Not just three lists. I think I have to use a for -loop but how?