Php curl_setopt()希望参数1是资源-curl问题
我的代码中有一个问题,我想通过CURL(小支付网关)获取信息,但我有下一个问题 警告:curl_setopt()要求参数1为resource,在第12行的/home/xxxxxx/public_html/xxxxxxx/myaccount/xxxx.php中为空 我还有下面的代码行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,
$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提供信息,我想问题出在服务器上。