Zorglub Posted August 23, 2021 Share Posted August 23, 2021 My try so far...: I want to get the data, then set all the cars up in a list (<li></li>) so I can style it later. <?php //The URL of the resource that is protected by Basic HTTP Authentication. $url = 'https://gw.bilinfo.net/listingapi/api/export'; //Your username. $username = 'demo'; //Your password. $password = 'ocfB6XzF73'; //Initiate cURL. $ch = curl_init($url); //Specify the username and password using the CURLOPT_USERPWD option. curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); //Tell cURL to return the output as a string instead //of dumping it to the browser. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Execute the cURL request. $response = curl_exec($ch); $jsonDecode = json_decode($url, true); echo "<b>Bil:</b> " . $jsonDecode['Vehicles']['Pictures']; //Check for errors. if(curl_errno($ch)){ //If an error occured, throw an Exception. throw new Exception(curl_error($ch)); } //Print out the response. echo $response; ?> Link to comment https://forums.phpfreaks.com/topic/313590-php-how-to-read-parse-json-so-i-can-style-the-text-in-html/ Share on other sites More sharing options...
Solution requinix Posted August 23, 2021 Solution Share Posted August 23, 2021 You already have a thread for this. Link to comment https://forums.phpfreaks.com/topic/313590-php-how-to-read-parse-json-so-i-can-style-the-text-in-html/#findComment-1589312 Share on other sites More sharing options...
Recommended Posts