http://www.getpincode.info/api/pincode?q=$cityname
example : http://www.getpincode.info/api/pincode?q=chirala
Output :
{"query":"chirala","pincode":"523155"}
<?php | |
$query = 'nariman point mumbai'; | |
$url = "http://www.getpincode.info/api/pincode?q=" . urlencode ($query); | |
$apidata = file_get_contents ($url); | |
$json = json_decode ($apidata, true); | |
# if no error found, then print pincode | |
if (array_key_exists ('error', $json)) | |
echo 'ERROR'; | |
else | |
echo $json ['pincode']; | |
?> |
0 comments:
Post a Comment