Curl不在我的本地服务器上发送

I am using below code to get user data but don't know why it saying invalid token error while i am using same code on another server and its working fine. I checked CURL is enabled in my system. You can see working example with below code on http://specificpromotions.com/test/test.php. What could be the problem please help me. Your help would be appreciated. thanks

$ch = curl_init();
//you will need to change the 'eric' to what the user is searching for in the manual entry section
$data = array('qFunc' => 'searchActiveStaff', 'qArgs' => 'eric');

curl_setopt($ch,CURLOPT_URL,'http://api.yfcimpact.com/yfc_dev.php/api/usa/person?' . http_build_query($data) );
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_USERPWD, "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJob3N0IjoiMTIwLjU5LjE1OS4yMzIiLCJ1c2VybmFtZSI6InJzbWl0aHR5MyIsImlkIjoxMDAwNTQwMjcwLCJpYXQiOjE0MzI4Nzk0NjQsImV4cCI6MTQzMjkwMTA2NCwicm9sZXMiOlsiUk9MRV9VU0VSIiwiUk9MRV9zZXR0aW5ncyIsIlJPTEVfcGVvcGxlIiwiUk9MRV9wZW9wbGVfYWRkX25ldyIsIlJPTEVfcGVvcGxlX2VkaXQiLCJST0xFX3BlcnNvbl9lZGl0X3Blcm1pc3Npb24iLCJST0xFX3NldHRpbmdzX3Blcm1pc3Npb25zIiwiUk9MRV9zZXR0aW5nc19jdXN0b21fZmllbGRzIiwiUk9MRV9vZmZpY2UiLCJST0xFX3NldHRpbmdzX21pbmlzdHJ5X3NpdGVzIiwiUk9MRV9zZXR0aW5nc19taW5pc3RyeV9zaXRlc19hZGQiLCJST0xFX3NldHRpbmdzX2xlZ2FsIiwiUk9MRV9wZW9wbGVfZWRpdF9saXN0IiwiUk9MRV9vZmZpY2VfZmluYW5jaWFsIiwiUk9MRV9vZmZpY2VfYnVkZ2V0X3BsYW4iLCJST0xFX29mZmljZV9taW5zdGF0cyIsIlJPTEVfc2V0dGluZ3NfZmllbGRfbGFiZWxzIiwiUk9MRV9vZmZpY2VfYmdjaGVjayIsIlJPTEVfb2ZmaWNlX3ZlaGljbGUiLCJST0xFX29mZmljZV93b3JrZXJzY29tcCIsIlJPTEVfc2V0dGluZ3NfY3VzdG9tX2ZpZWxkX2dyb3VwcyIsIlJPTEVfc2V0dGluZ3NfdGV4dCIsIlJPTEVfc2V0dGluZ3NfZW1haWwiLCJST0xFX29mZmljZV9jaGFydGVyaW5nIiwiUk9MRV9ldmVudHMiLCJST0xFX3NldHRpbmdfY3VzdG9tcXVlc3Rpb25zIl0sImZ1bGxOYW1lIjoiUm9nZXIgU21pdGgiLCJjb3JlT3JnSWQiOiI0MjcifQ.V9B-TE_72D0YYE5FAHPB_pkYGhkAGiHRQzZjTEb0Jag:" );

$json = curl_exec($ch);
$people = json_decode($json);

print "people who have eric in their name:
";
var_export($people);

In some APIs (like Facebook API), you register an application, so that each token is bonded with a specific domain. So, in case the API you are using has the same logic, the token used is bonded to the domain of your server (specificpromotions.com), so that in order to use it from a different server (aka different domain), you will have to use a separate token.

However, I tried to execute your script and the I had no problem fetching the data from the api in exactly the same format of your link.

So, there is for sure no domain binding in the authentication system of the API. So, I think you will have to check your system-wide configuration to find the reason curl is not working.

You could try looking at the error returned from the curl operation using curl_error: http://php.net/manual/en/function.curl-error.php

Firstly check if the curl is enabled in your system or server. You can check it by using a simple page with this code.

<?php 
 phpinfo();
?>

If curl is enabled it will show there. If its not enabled enable it. You can check this link for that.

Next check for the curl errors and clear it. Just add this code after the curl_exec($ch);

    $ch = curl_init();
    $data = array('qFunc' => 'searchActiveStaff', 'qArgs' => 'eric');
    curl_setopt($ch,CURLOPT_URL,'http://api.yfcimpact.com/yfc_dev.php/api/usa/person?' . http_build_query($data) );
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_USERPWD, "ag:" );    
    if(curl_exec($ch) === false)
{
    echo 'Error Details: ' . curl_error($ch);
}
else
{
    echo 'Success';
}