Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP CURL库给出错误';超过费率限制';类型为';无效的访问错误';_Php_Curl - Fatal编程技术网

PHP CURL库给出错误';超过费率限制';类型为';无效的访问错误';

PHP CURL库给出错误';超过费率限制';类型为';无效的访问错误';,php,curl,Php,Curl,我试图通过PHP CURL库调用API。但是每次我调用这个错误时都会出现 Array ( [error] => Array ( [type] => invalid_access_error [message] => Rate limit exceeded ) ) 如果你看一下你的利率限额,你就会知道你是否达到了限额 $curl = curl_init(); //$result=$

我试图通过PHP CURL库调用API。但是每次我调用这个错误时都会出现

Array ( 
    [error] => Array ( 
            [type] => invalid_access_error 
            [message] => Rate limit exceeded 
            ) 
    )

如果你看一下你的利率限额,你就会知道你是否达到了限额

$curl = curl_init();
//$result=$this->cronjob_model->get_new_appoiment();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.dentally.co/rate_limit",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer 2549fc0ac144797a850a9583e3f685d06b830fd6cc17d8dfe4867fce82adb6bc"
    ),
));


$result = curl_exec($curl);
$someArray=json_decode($result, true);
print_r($someArray);
我猜在测试期间,您经常调用API,并且已经超出了限制,现在似乎已经重置了限制


你说的对吗?多谢了,它现在起作用了。
$curl = curl_init();
//$result=$this->cronjob_model->get_new_appoiment();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.dentally.co/rate_limit",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer 2549fc0ac144797a850a9583e3f685d06b830fd6cc17d8dfe4867fce82adb6bc"
    ),
));


$result = curl_exec($curl);
$someArray=json_decode($result, true);
print_r($someArray);

Array
(
    [resources] => Array
        (
            [core] => Array
                (
                    [limit] => 3600
                    [remaining] => 3422
                    [reset] => 1615456800
                )

            [appointment_availability] => Array
                (
                    [limit] => 200
                    [remaining] => 200
                    [reset] => 1615456800
                )

            [sms] => Array
                (
                    [limit] => 300
                    [remaining] => 300
                    [reset] => 1615507200
                )

        )

)