Json数据无法正常显示

时间:2017-05-10 00:20:01

标签: php json

我正在尝试从json数据中获取值并在行中显示相同的值。但我面临的问题是我无法显示任何数据。这是我从中获取值的网址您可以在链接中点击查看值。You can click here to view the response of the json daya

现在这里是代码

<?php
$ch = curl_init(); 
$timeout = 30;
$myurl = "https://joloapi.com/api/findplan.php?userid=Akash4196&key=253258928289764&opt=28&cir=1&typ=TUP&max=&amt=";
curl_setopt ($ch, CURLOPT_URL, $myurl);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$jsonxx = curl_exec($ch);
$curl_error = curl_errno($ch);
curl_close($ch);
$someArray = json_decode($jsonxx, true);
if (count($someArray) > 0) {
echo "<table><thead><tr>
<th>Detail</th>
<th>Amount (Rs.)</th>
<th>Validity (days)</th>
</tr></thead><tbody>";
foreach ($someArray as $key => $value) {
 echo " <tr><td>" .$value["Detail"] . "</td> <td>" .$value["Amount"] . "
</td> <td>" .$value["Validity"] . "</td> </tr>";
 }
 echo "</tbody></table><br/>";

 }else{
 echo"No offer details available for this category";
 }
  ?>

如果链接由于IP地址错误而无法正常工作,请检查屏幕截图

Please View the image for the response of the URL

0 个答案:

没有答案