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

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

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

模擬get或post

2016.03.14 | 2647閱讀 | 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ā)表評論

孝昌县| 新津县| 塔城市| 开封县| 枝江市| 互助| 边坝县| 乌兰浩特市| 玉树县| 饶平县| 耿马| 焦作市| 姜堰市| 年辖:市辖区| 洛扎县| 博乐市| 呼玛县| 沁阳市| 内黄县| 德格县| 中卫市| 八宿县| 三台县| 九龙县| 普格县| 嘉鱼县| 桐乡市| 象山县| 宝清县| 东海县| 洮南市| 常州市| 平定县| 临汾市| 孟津县| 保定市| 柯坪县| 赤水市| 霍邱县| 永清县| 错那县|