On a website named www.zolano.ro it happens something, saved into a json string.
I can transfer this data by calling from another website trough this code in php:
Code: Select all
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data))
);
curl_setopt($curl, CURLOPT_URL, 'http://www.zolano.ro/'); // The url path we want to call
$result = curl_exec($curl);
//see the results
$valami=json_decode($result,true);
curl_close($curl);
foreach ($valami as $xxx) { //is arrays in array ...so is a table content with 3 columns
foreach ($xxx as $yyy) {
print_r($yyy[0]); echo " ";
print_r($yyy[1]); echo " ";
print_r($yyy[2]); echo "<br>";
};
};
I have to mention that I checked the sample of master Rathinagiri, but there I have to call/recieve the string, not just to read from a file with .json extension.
Normally I can save the json string into a file in this way ...
Code: Select all
$fp = fopen('results.json', 'w');
fwrite($fp, json_encode($result,true));
fclose($fp);
Best regards,
Zoli B.