虽然用于指定URL的函数的参数未被识别或启动,但我正在使用来自php.net manuals的热门评论的cURL函数。现在,当我启用CURLOPT_URL
并指定数组中的URL时,它将显示网页,并且数组会返回相应的信息,但我不希望显示网页,只需返回数组中的信息,但需要curl_exec总之它总是显示网页。cURL无法确认函数参数
我在做什么错了?
使用CURLOPT_RETURNTRANSFER => false,
我知道
//defines the function get_web_page
$url = "http://ulrichzukowebtv.comli.com";
function get_web_page($url)
{
$options = array(
//CURLOPT_URL => 'http://ulrichzukowebtv.comli.com',
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch);
$header = curl_getinfo($ch);
curl_close($ch);
$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['content'] = $content;
return $header;
} //end defining function
$curl_data = "var1=60&var2=test";
//call the function
$response = get_web_page($url, $curl_data);
print '<pre>';
//Returns an array containing all the CURL flags specified
print_r($response);
我将它设置为'FALSE',我仍然无法确认'$ url' – Tower 2012-02-28 18:03:05