Im trying to create a link with JSON and PHP -


i have php file renders out json call , im trying wrap links titles using php.

<?php $jsondata = file_get_contents     ("https://app.citizenspace.com/api/2.3/json_consultation_details?    dept=parliament&id=ddcengage&fields=all");  $json = json_decode($jsondata,true); $output = "<ul>"; foreach($json['related_links'] $relatedlinks) { $output .= "<li>".$relatedlinks['title']."</li>"; $output .= "<h4>".$relatedlinks['url']."</h4>";  }  $output .= "</ul>"; echo $output; ?> 

what need create title url?

you mean below code:

$output .= "<li><a href=".$relatedlinks['url'].">".$relatedlinks['title']."</a></li>";

?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -