Advertisement
Guest User

Untitled

a guest
Feb 17th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. $username='Rinkana';
  4. $password='test';
  5. $URL='http://127.0.0.1:9000/api/session/status?attributes&members&participants';
  6.  
  7. $ch = curl_init();
  8. curl_setopt($ch, CURLOPT_URL,$URL);
  9. curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  11. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  12. curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  13. $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   //get status code
  14. $result=curl_exec ($ch);
  15.  
  16. curl_close ($ch);
  17.  
  18. $result = json_decode($result, true);
  19.  
  20. foreach($result['response']['participants'] as $key => $value) {
  21.     $platzierungen[$key] = $value['attributes']['RacePosition'];
  22. }
  23.  
  24. array_multisort($platzierungen, SORT_ASC, $result['response']['participants']);
  25.  
  26. echo json_encode($result);
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement