У меня есть одна форма, и я создал один URL-адрес для извлечения данных. Он правильно извлекает данные, но когда я нажимаю URL-адрес, он показывает мне {"error": "null"}. Как получить представленную стоимость? Я не могу отображать веб-службы. Я пытаюсь создать веб-сервис. После подачи формы, когда я пытаюсь ударить URL со значениямиPHP url не удалось получить отправленные данные
http://www.apnapaisa.com/ajaxv2/getCompareResults.html?rateType=Both&occupation=Salaried&offeringTypeId=31&city=79&loanAmt=500000&q=&age=27
это дает мне { "ошибка": "нулевой"} ошибки
<?php
if($_POST["occupation"] == '1'){
$occupation = 'Salaried';
}
else{
$occupation = 'Self+Employed';
}
$url = 'http://www.apnapaisa.com/ajaxv2/getCompareResults.html?productId='.$_POST["product_id"].'&rateType=Floating&occupation='.$occupation.'&monthlyIncome='.$_POST["dincome"].'&offeringTypeId='.$_POST["offeringID"].'&city='.$_POST["city"].'&monthlyIncomeSingle='.$_POST["dincome"].'&loanAmt='.$_POST["loan"].'&q='.$_POST["q"].'&age='.$_POST["age"].'&tenure='.$_POST["tenure"];
echo $url;
// Initiate curl
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$json = json_decode($result, true);
//print_r($json);
//echo $json['resultList']['interestRateMin'];
$json_array = $json['resultList'];
//print_r($json_array);
?>
<?php
if (is_array($value)) {
foreach ($json['resultList'] as $key=>$value) {
if($json["resultList"][$key]["interestRateMin"] == $json["resultList"][$key]["interestRateMax"]){
$interest = $json["resultList"][$key]["interestRateMin"];
}
else{
$interest = $json["resultList"][$key]["interestRateMin"].' - '.$json["resultList"][$key]["interestRateMax"];
}
echo '
<div class="bank-rates">
<ul>
<li><div class="innr-spl" style="padding: 5px 0;"><span style="display:block;"><img src="'.$json["resultList"][$key]["imageUrl"].'"></span></div></li>
<li><div class="innr-spl2">'.$json["resultList"][$key]["interestRateMin"].'%'.'</div></li>
<li><div class="innr-spl2">60</div> </li>
<li class="hide"><div class="innr-spl3 view-detail1" id="'.$key.'"><i class="fa fa-chevron-circle-down" aria-hidden="true"></i>View Datails</div> </li>
<li><div class="apply-now innr-spl"><a href="#" type="button" role="button" target="_blank" class="btn-apply">Apply Now</a></div></li>
</ul>
<div style="clear:both"></div>
<div id="ban_'.$key.'">
<ul class="details" id="details1">
<li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Maximum Loan Amount : '.$json["resultList"][$key]["loanAmt"].'</li>
<li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Max Tenure (In Years) : '.$json["resultList"][$key]["tenure"].'</li>
<li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Interest Rate Type : '.$json["resultList"][$key]["rateType"].'</li>
</ul>
</div>
</div>
';
$i++;
}
}
?>
Бррр. Пожалуйста, прочитайте о urlescaping или при создании URL-адресов таким образом. – arkascha
Является ли метод api 'get' или' post'? –
Я использовал метод post – user5397448