I would like to use cURL to get all orders using rest API. Can I use cURL instead of Oath.
I tried with cURL but returns 403 Forbidden.
I have tried with below code :
$params = array(
"oauth_callback" => $oauthCallback,
"oauth_consumer_key" => $oauthConsumerKey,
"oauth_nonce" => $oauthNonce,
"oauth_signature_method" => $oauthSignatureMethod,
"oauth_timestamp" => $oauthTimestamp,
"oauth_version" => $oauthVersion,
);
$header = "";
foreach ($params as $key=>$value){
$header .= $key.'="'.$value."\", ";
}
$header .= "oauth_signature=\"".$oauthSignature.'"';
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_HTTPHEADER, array($header));
curl_setopt($curl, CURLOPT_URL, $endpointUrl);
$response = curl_exec($curl);
echo "<pre>";
print_r($response);
curl_close($curl);