国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP ? ?? ?? ? ??

? ?? ??? ?? ?? ???? ??? ??? ?? ????? ????? ????. ??? ??????, ???, ?? ???? ?? ???? ??? ????. ?? ??? ??? ?? ????? ???? ??? ??????.

curl? ??? ?? 7??? ????.

1. ? ??? ???

2. ???? ?? ?? ???? ??

3. ???? ??? ?? ??? ?????

4. ?? ???? ?????(?? ???? ??? ??? ?? ??)

5. ?? ???? ?? ?? (?? ?? ??? ?? ??)

6. ?? ?? ?? ??? ?? ?? ??

7. ? ???? ????

??? ? ? ?? ? ??? ???? 2??? 2??? ???????. ??? ??? ????? ? 5??? 4??? ???????.

2~5??? ????? ? ???? ???? ????? ???.

?? ? ?? ????? ?_setopt? ?? ?????.

curl_setopt ? ??? ?? ???? ?? ??? ??? ????.

? ??? ?_setopt ??, ???? ? ?? ??? ??? ?? ??? ?????. ???? ?? ???? ?? ??? ? ???? ?? ????? ??? ??? ??? ?????.

? ?? ??? ?? ????. ??? ??? PHP?? ?? ?? ???? ?? http ?????. ????, ??? ??? ?? ?? ?? ???? ???? ?????.

?? ??? ??? ?_???? ?? ???? ??? ????? ???.

??? ??? ????: http://php.net/manual/zh/function.curl-setopt.php

1. ?? ??

? ??? ???, ?, cur_init ??? ?????. ? ???? ???? ????? ????? ???? ???. ? ?? ???? ?????.

??? ?_setopt? ?? ?? ?? ??? ??? ???? ???? ?????.

?:

$ch = curl_init();

2. ???? ?? ??? ???? ??

curl_setopt ??? ??? ???? ??? ????.

類型說明
函數(shù)curl_setopt
參數(shù)1curl資源變量
參數(shù)2curl參數(shù)選項
參數(shù)3curl參數(shù)值

CURLOPT_URL ? ???? ??? ??? URL ??? ?????.

curl_setopt($ch, CURLOPT_URL, "http://miracleart.cn");

3. ???? ??? ?? ??? ????? ??

curl ??? ?? ??? ????? ????. ?? ??? ???? ???? ??? CURLOPT_RETURNTRANSFER? ???? ???.

??? ?? ?? ?? 1???. ??? ?? ? ???? ??? 0?? ??? ? ????.

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

4. ?? ??? ??

GET ??? ?? ?? ????? ??? ??? ????. ???? ??? ???? ?? ?? ??? ?? ???? ???? ???. ??? ??? ???? ?????.

*CURLOPT_POST *POST ??? ????? ?? 1? ????, POST ??? ???? ???? 0?? ?????.

CURLOPT_POSTFIELDS??? ???? ??

//聲明使用POST方式來進(jìn)行發(fā)送
    curl_setopt($ch, CURLOPT_POST, 1);
//發(fā)送什么數(shù)據(jù)呢
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

5. ?? ???? ?? ??

https? ?? https? ?? ???? ???? ?? ??? ????.

? ???? CURLOPT_SSL_VERIFYPEER ? CURLOPT_SSL_VERIFYHOST? false? ???? ???? ?????.

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

CURLOPT_HEADER ? ????? http ?? ??? ???? ??? ?????. ??? ???? ???? ? ?? 0?? ??? ? ????.

curl_setopt($ch, CURLOPT_HEADER, 0);

??? ?? ?? ??? ??? ?? ????. ????? CURLOPT_TIMEOUT???.

curl_setopt($ch, CURLOPT_TIMEOUT, 10);

??? ???? ?? ?? ????? ????. ? ?? ??? ??? ?????.
??? ??? ????: http://php.net/manual/ zh/function.curl -setopt.php

6. ?? ?? ???? ?? ?? ??

? ?? ???? CURLOPT_RETURNTRANSFER ???? ?? 1? ?????. ?? ??? ???? ?? ??. Curl_exec? ???? ??? ? ??? $output ??? ?????.

rree

7. ? ???? ????.

? ???? ????. ??? ?? ??? ?? ???? ?? ?? ???????.

???? ?? ???? cur_close? ???? ?? ???? ?? ?????.

$output = curl_exec($ch);

8丶 ? ??? ????

curl_close($ch);


???? ??
||
<?php //初始化 $ch = curl_init(); //設(shè)置選項,包括URL curl_setopt($ch, CURLOPT_URL, "http://miracleart.cn"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); //執(zhí)行并獲取HTML文檔內(nèi)容 $output = curl_exec($ch); //釋放curl句柄 curl_close($ch); //打印獲得的數(shù)據(jù) print_r($output); ?>