Hi,
I have been trying make curl command work in PHP but no luck. Could anyone help me out where I'm going wrong
$endpoint = "https://ehive.com/api/oauth2/v2/authorize";
$header[] = "Content-Type: application/x-www-form-urlencoded" ;
$header[]= "Client-Id: ....5056";
$header[] = "Client-Secret: ....4eab";
$header[] = "Authorization: OAuth";
$header[] = "Grant-Type: client_credentials";
$curl = curl_init($endpoint);
curl_setopt($curl, CURLOPT_HEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
$json_response = curl_exec($curl);
*Question from old eHive forum*
Had to pass empty array as Post fields. So in case someone needs it in future
curl
-v
-H "Content-Type: application/x-www-form-urlencoded"
-H "Client-Id: <your clientId>"
-H "Client-Secret: <your clientSecret>"
-H "Authorization: OAuth"
-H "Grant-Type: client_credentials"
-X POST https://ehive.com/api/oauth2/v2/authorize
will look like this in php
$endpoint = 'https://ehive.com/api/oauth2/v2/authorize';
$header[] ='Content-Type:application/x-www-form-urlencoded';
$header[]='Client-Id:...5056';
$header[]='Client-Secret:...4eab';
$header[]='Authorization:OAuth';
$header[]='Grant-Type:client_credentials';
$postData = array();
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
Leisa Taylor
Hi,
I have been trying make curl command work in PHP but no luck. Could anyone help me out where I'm going wrong
$endpoint = "https://ehive.com/api/oauth2/v2/authorize";
$header[] = "Content-Type: application/x-www-form-urlencoded" ;
$header[]= "Client-Id: ....5056";
$header[] = "Client-Secret: ....4eab";
$header[] = "Authorization: OAuth";
$header[] = "Grant-Type: client_credentials";
$curl = curl_init($endpoint);
curl_setopt($curl, CURLOPT_HEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
$json_response = curl_exec($curl);
*Question from old eHive forum*
Had to pass empty array as Post fields. So in case someone needs it in future
curl
-v
-H "Content-Type: application/x-www-form-urlencoded"
-H "Client-Id: <your clientId>"
-H "Client-Secret: <your clientSecret>"
-H "Authorization: OAuth"
-H "Grant-Type: client_credentials"
-X POST https://ehive.com/api/oauth2/v2/authorize
will look like this in php
$endpoint = 'https://ehive.com/api/oauth2/v2/authorize';
$header[] ='Content-Type:application/x-www-form-urlencoded';
$header[]='Client-Id:...5056';
$header[]='Client-Secret:...4eab';
$header[]='Authorization:OAuth';
$header[]='Grant-Type:client_credentials';
$postData = array();
$curl = curl_init($endpoint);
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
$json_response = curl_exec($curl);
Leisa Taylor
Had to pass empty array as Post fields. So in case someone needs it in future
curl
-v
-H "Content-Type: application/x-www-form-urlencoded"
-H "Client-Id: <your clientId>"
-H "Client-Secret: <your clientSecret>"
-H "Authorization: OAuth"
-H "Grant-Type: client_credentials"
-X POST https://ehive.com/api/oauth2/v2/authorize
will look like this in php
$endpoint = 'https://ehive.com/api/oauth2/v2/authorize';
$header[] ='Content-Type:application/x-www-form-urlencoded';
$header[]='Client-Id:...5056';
$header[]='Client-Secret:...4eab';
$header[]='Authorization:OAuth';
$header[]='Grant-Type:client_credentials';
$postData = array();
$curl = curl_init($endpoint);
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
$json_response = curl_exec($curl);