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

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

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

模擬get或post

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

全南县| 西宁市| 松滋市| 虞城县| 申扎县| 盐边县| 玛沁县| 明水县| 七台河市| 罗江县| 平果县| 舒城县| 滨海县| 十堰市| 永定县| 双牌县| 咸丰县| 博罗县| 灌云县| 故城县| 陆川县| 美姑县| 自贡市| 广州市| 扎鲁特旗| 木兰县| 吉隆县| 大冶市| 河西区| 锡林浩特市| 建瓯市| 万源市| 临漳县| 垫江县| 海兴县| 丘北县| 稻城县| 镇宁| 定安县| 呼玛县| 陆良县|