php - How to use GET on an external URL -
i using api returns json get request
eg.
https://api.domain.com/v1/account/{auth_id}/call/{call_uuid} returns
{ "call_duration": 4, "total_amount": "0.00400" } how can call page within script , save call_duation , total_amount separate variables?
something following?:
$call_duration = $_get[https://api.domain.com/v1/account/{auth_id}/call/{call_uuid}, 'call_duration'];
$_get[] contains get parameters passed code - don't generate get request.
you use curl make request:
$ch = curl_init("https://api.domain.com/v1/account/{auth_id}/call/{call_uuid}"); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); curl_close($ch); $result = json_decode($output);
Comments
Post a Comment