I have been struggling with the following code for some time. I get the following error: {"error":"invalid_request","error_description":"invalid grant type"}.
Some more documentation on the API that I am working on is available here::
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://id.shoeboxed.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => "{\"code\": \"['code']\",\"grant_type\":\"authorization_code\",\"redirect_uri\": \"http://website.com/foursquare2.php\",\"client_id\": \"f8de67be8dc84e449203fcdd4XXXXXXX\",\"client_secret\": \"HS5ZeIVsKW0/qqiO9/XcdeWqnF8vtzQrpY8gcdrxg0BXNZXXXXXXX\"}",
CURLOPT_HTTPHEADER => array(
"application/x-www-form-urlencoded"
)
));
/*
//Another Attempt at it is below
curl -d code=['code'] \
-d grant_type=authorization_code \
--data-urlencode redirect_uri='http://website.com/foursquare2.php' \
-u f8de67be8dc84e449203fcdd44abad5a:HS5ZXXXXXXX/qqiO9/XcdeWqnF8vtzQrpY8gcdrxg0BXNXXXXXXX \
-XPOST https://id.shoeboxed.com/oauth/token
*/
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>