99麻豆久久久国产免费福利精品,国产精品成人国产乱,玖玖操,手机看片169,国产精彩视频在线观看,午夜亚洲福利视频,国产伦乱视频

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

模擬get或post

2016.03.14 | 2762閱讀 | 0條評論 | php

CURL方式:

public function httpCurl($url,$data) {

$curl = curl_init ();

curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, true );

curl_setopt ( $curl, CURLOPT_TIMEOUT, 500 );

curl_setopt ( $curl, CURLOPT_SSL_VERIFYPEER, false );

curl_setopt ( $curl, CURLOPT_SSL_VERIFYHOST, false );

curl_setopt ( $curl, CURLOPT_URL, $url );

if (!empty($data))

{

  curl_setopt ( $curl, CURLOPT_POST, 1 );

  curl_setopt ( $curl, CURLOPT_POSTFIELDS, $data );

}

$res = curl_exec ( $curl );

curl_close ( $curl );

return $res;

}




數(shù)據(jù)流方式:

/**

*Huang Jing

*2016年1月12日 10:51:29

*Http 客戶端   實例

*Post方法

******/


class HttpClient {

  //post方法提交

  public static function post2($url, $data) {  //file_get_content

        $postdata = http_build_query( $data );

        $opts = array('http' =>

                      array(

                          'method'  => 'POST',

                          'header'  => 'Content-type:application/x-www-form-urlencoded;charset=GBK',

                          'content' => $postdata

                      )

        );

 

        $context = stream_context_create($opts);

        $result = file_get_contents($url, false, $context);

         return  $result;

    }

}


贊 (

發(fā)表評論

沙坪坝区| 治县。| 格尔木市| 留坝县| 忻州市| 年辖:市辖区| 呼图壁县| 沙洋县| 米泉市| 宜城市| 宣汉县| 大连市| 嵩明县| 前郭尔| 嘉黎县| 濮阳县| 丰宁| 桂平市| 威宁| 渝中区| 东乡族自治县| 寿宁县| 邯郸市| 合川市| 东阳市| 萝北县| 鹿泉市| 微山县| 麻栗坡县| 平邑县| 城步| 高唐县| 建宁县| 东阳市| 广饶县| 拉孜县| 涿州市| 卢氏县| 镇雄县| 霍山县| 南漳县|