0

In my earlier post I asked for help to parse data from an external website, for so far I finnaly get some content from the website I want the data from. But I can't get the kilometers not displayed, and I dont know exactly how to do it the right way, but I think im on the right way. Hope some one can help me further.

Website data I want to parse: http://basic.usedcarportal.nl/html/result.php?klant=00843&klantnr=950

Results with my code: http://zoo-media.nl/script/

Code:

<?php

$post = [
'bouwjaar-max' => '2011',
'bouwjaar-min' => '1999',
'cilinder-max' => '100000',
'cilinder-min' => '0',
'field' => 'renew',
'groepnr' => '',
'klant' => '00843',
'klantnr' => '950',
'km-max' => '100000',
'km-min' => '0',
'limit' => '10',
'order' => 'ASC',
'postcode' => '',
'prijs-max' => '100000',
'prijs-min' => '0',
'result' => 'on',
'sort' => 'prijs',
'start' => '0',
'uid' => ''
];

$ch = 
curl_init('http://basic.usedcarportal.nl/get_handlers/get_zoek.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$response = curl_exec($ch);

curl_close($ch);

$jsondata = json_decode($response);


foreach ($jsondata->resultset->data as $v) {


 echo '
 <hr>
 <img src="'.$v->foto.'"><br />
 '.$v->uitvoering.'<br />
 '.$v->verkoopprijs.'<br />
 <br/>
 ';
}

?>
Hessel
  • 77
  • 7
  • This is overly broad for a question. What do you mean `I can't get the kilometers not displayed, and I dont know exactly how to do it the right way`? You should show a JSON snippet and then just the code you're trying to output it with – Machavity Jul 17 '18 at 16:51
  • Hi Mario, thanks for your reply, I'm junior front-end so this parts is also really new to me. I dont even know how the data get parsed with varaible 'verkoopprijs'. Where can I find that fields? Thats is more the question, how I can find the variable names I want to parse.. – Hessel Jul 17 '18 at 17:03
  • You should read the duplicate question, then. It explains how to get data from JSON using PHP – Machavity Jul 17 '18 at 17:04
  • @Machavity Thanks for the reply, I see but the thing is, where I can see the fields of the external website to parse with JSON, I can't get them? – Hessel Jul 17 '18 at 17:11
  • If you can't provide the JSON you're trying to parse, how do you expect us to help you? – Machavity Jul 17 '18 at 17:12
  • I understand, but I tried something and get results, but I want to know where I need to begin. But indeed I could format this question in a better way.. @Machavity – Hessel Jul 17 '18 at 17:14

0 Answers0