I am trying to parse the JSON response from PHP. How can i get values from JSON response by keys.Thanks in advance.
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'https://www.instamojo.com/api/1.1/payment-requests/');
curl_setopt($ch,CURLOPT_HTTPHEADER,array('X-Api-Key: SomeKEY','X-Auth-Token: SomeToken'));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($req_data,'','&'));
curl_setopt($ch,CURLOPT_TIMEOUT,130);
$json= curl_exec($ch);
if($err=curl_error($ch)) {
var_dump($err);
}
var_dump($json);
$jsonArray= json_decode($json,true);
$jsonArray['payment_request']['longurl']
should have the long url value you are looking for.
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.