//1.初始化连接句柄

$ch = curl_init();

//2.设置选项, 包括URL

curl_setopt($ch, CURLOPT_URL, "http://www.test.com");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HEADER, 0);

//3.执行并获取HTML文档内容

$output = curl_exec($ch);

if($outpub === false) {

    echo "CURL Error:".curl_error($ch);

}

//4.释放curl连接句柄

curl_close($ch);


0/300
全部评价