Created
October 19, 2011 16:44
-
-
Save jimmy-collazos/1298886 to your computer and use it in GitHub Desktop.
Moventos-Api Test :: Send trainer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$params = array( | |
'cat' => 'a' | |
,'resumen'=> json_encode(array( | |
'speed' => array ( | |
'a' => 12,//media | |
'b' => 21,//max | |
), | |
'time' => array ( | |
'a' => 1318513036,//start | |
'b' => 1318518362,//end | |
'c' => 15326, //total | |
), | |
'altitude' => array ( | |
'a' => 1500,//min | |
'b' => 1750,//max | |
'c' => 0,//altitud-acomulada | |
'd' => 0,//altitud-perdida | |
), | |
'distance' => 1500 | |
)) | |
,'track' => json_encode(array( | |
array('x'=>0,'y'=>0,'z'=>0,'t'=>1318513036,'v'=>23,'m'=>0) | |
,array('x'=>0,'y'=>0,'z'=>0,'t'=>1318513037,'v'=>23,'m'=>1) | |
)) | |
); | |
//open connection | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_VERBOSE, 1); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); | |
curl_setopt($ch, CURLOPT_URL,'http://www.moventos.com/wapi/trainer/'); | |
curl_setopt($ch, CURLOPT_POST,1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS,$params); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: masterKeyForTest-aaaabbbbccccddddeeeeffffgggghhhh")); | |
//execute post | |
$result = curl_exec($ch); | |
//close connection | |
curl_close($ch); | |
//Show result | |
var_dump( json_decode($result) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment