Skip to content

Instantly share code, notes, and snippets.



Created May 12, 2017
What would you like to do?
Check surge multiplier
$ch = curl_init();
$headers[] = "Authorization: Token YOUR_TOKEN";
$headers[] = "Accept-Language: en_US";
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//get surge from old api. v1.2 surge multiplier is not available because we have upfront pricing now.
curl_setopt($ch, CURLOPT_URL, ''.$argv[1].'&start_longitude='.$argv[2].'&end_latitude='.$argv[1].'&end_longitude='.$argv[2]);
$content = curl_exec($ch);
$surge = json_decode($content)->prices[0]->surge_multiplier;
echo ($surge==1?'No surge':$surge.'x surge') . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.