Trying simple search using envato api using php and curl

Can’t figure out what is wrong with my code, Can anyone help.


$url = ‘’;
$info = array(
‘Authorization :’ =>‘Bearer xxxxxxxxxxxxxxxxxxxx’
$post_field_string = http_build_query($info, ‘’, ‘&’);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_field_string);
curl_setopt($curl, CURLOPT_HEADER,1);
$exec = curl_exec($curl);
echo ‘

curl_close($curl) ;

After I run this code output i get

HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: application/json; charset=utf-8
Expires: 0
Pragma: no-cache
Vary: *
X-Frame-Options: Deny
X-Powered-By: Express
Content-Length: 70
Date: Tue, 15 Mar 2016 09:52:20 GMT
Connection: close

{“error”:“access_denied”,“error_description”:“Bearer token not found”}


You should send Bearer as CURLOPT_HTTPHEADER constant like that:

CURLOPT_HTTPHEADER => array( 'Authorization: Bearer xxxxxxxxxxxxx' )

Hope this helps…