Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.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_setopt()希望参数1是资源-curl问题_Php_Curl - Fatal编程技术网

Php curl_setopt()希望参数1是资源-curl问题

Php curl_setopt()希望参数1是资源-curl问题,php,curl,Php,Curl,我的代码中有一个问题,我想通过CURL(小支付网关)获取信息,但我有下一个问题 警告:curl_setopt()要求参数1为resource,在第12行的/home/xxxxxx/public_html/xxxxxxx/myaccount/xxxx.php中为空 我还有下面的代码行 $getbin = 'https://binlist.net/json/".$bin."'; $get = curl_init(); curl_setopt($curl, CURLOPT_URL,

我的代码中有一个问题,我想通过CURL(小支付网关)获取信息,但我有下一个问题

警告:curl_setopt()要求参数1为resource,在第12行的/home/xxxxxx/public_html/xxxxxxx/myaccount/xxxx.php中为空

我还有下面的代码行

$getbin  = 'https://binlist.net/json/".$bin."';
    $get  = curl_init();
    curl_setopt($curl, CURLOPT_URL, $getbin);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    $exec  = curl_exec($get);
    curl_close($get);
    $cc           = json_decode($exec);
    $ccbrand      = $cc->brand;
    $ccbank       = $cc->bank;
    $cctype       = $cc->card_type;
    $ccklas       = $cc->card_category;

你能帮我吗?非常感谢您将
curl\u setopt
设置为
$curl
,但将新会话初始化(并返回curl句柄)为
$get
。您应该这样更改
curl\u setopt
行:

curl_setopt($get, CURLOPT_URL, $getbin);
curl_setopt($get, CURLOPT_RETURNTRANSFER, true);
curl_setopt($get, CURLOPT_FOLLOWLOCATION, true);

这样,您就可以设置cURL句柄的选项了。
$get

我试过了,但是它没有通过cURL提供信息,我想问题出在服务器上。