请有人帮助我了解在curl php中设置opt的区别。
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "abcxyz",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.5",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Cookie: ht=7635aa7ceda60bf1",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0"
),
));
和
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "abcxyz",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_COOKIE => "ht=7635aa7ceda60bf1",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0",
CURLOPT_HTTPHEADER => array(
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.5",
"Cache-Control: no-cache",
"Connection: keep-alive"
),
));
尝试使用CURLOPT_COOKIE和CURLOPT_USERAGENT时总是出现错误。