Guest User

Untitled

a guest
Aug 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $response = '{"0": '.$data.'}';
  2. $ch = curl_init();
  3. $ch2 = curl_init();
  4.  
  5. $dataArray = array('command' => 'insert', 'type' => 'timechart','name' => 'nbEmprunts' , 'data' => $response );
  6. $dataDate = date('Y-m-d\TH:i:s\Z');
  7.  
  8. $dataCurl = "[{ \"type\" : \"pretz\", \"time\" : \"$dataDate\", \"data\" : { \"emprunts\" : $data} }]";
  9. curl_setopt($ch, CURLOPT_URL, 'dosiboard.univ-avignon.fr/manager/manager.php');
  10. curl_setopt($ch, CURLOPT_POST, 1);
  11. curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13. curl_exec($ch);
  14. curl_close($ch);
  15.  
  16. curl_setopt($ch2, CURLOPT_URL, 'cumble00c.univ-avignon.fr:1080/1.0/event/put');
  17. curl_setopt($ch2, CURLOPT_POST, 1);
  18. curl_setopt($ch2, CURLOPT_POSTFIELDS, $dataCurl);
  19. curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
  20. curl_exec($ch2);
  21. curl_close($ch2);
Add Comment
Please, Sign In to add comment