Im trying to send a message using php and cURL; I've managed to get the access token but im having trouble with the required format for the request parameter, I no its "Body,ContainsMarkup,From,To" but all i get when i execute the code is an unhelpful "Request Error" page saying "The server encountered an error processing the request. Please see the service help page for constructing valid requests to the service.". Any help would be appreciated.
/*got $access_token from OAuth reply*/
$c = curl_init();
$url = 'http://api.mxit.com/message/send/';
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_POST, true);
//not sure about "Content-Type" or "Accept"
$h = array();
$h [] = "Content-Type: application/json";
$h [] = "Accept: application/json";
$h [] = "Authorization: Bearer " . $access_token;
curl_setopt($c, CURLOPT_HTTPHEADER, $h);
//what should $requestString look like?!?!?!?!
curl_setopt($c, CURLOPT_POSTFIELDS, $requestString);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($c);
echo($result);
//close connection
curl_close($c);
}
}


Reply With Quote