Home > Backend Development > PHP Tutorial > php curl怎么以get方式提交

php curl怎么以get方式提交

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:19:42
Original
1469 people have browsed it

例如:http://localhost/openapi/holiday/Line/Query/GetLineComment?AllianceId=12&DigitalSign=7aeac3d1c621c30c144f23b5a498bbda01895b70&ReqTime=2013-09-02 16:23:49.929

这个地址用get怎么提交

回复内容:

例如:http://localhost/openapi/holiday/Line/Query/GetLineComment?AllianceId=12&DigitalSign=7aeac3d1c621c30c144f23b5a498bbda01895b70&ReqTime=2013-09-02 16:23:49.929

这个地址用get怎么提交

curl 默认就是以 GET 提交的,如果为POST提交,请检查是否配置了 curl_setopt($c, CURLOPT_POST, 1); 这个参数

<code>    /**
     * GET 请求
     * @param string $url
     */
    private function http_get($url){
        $oCurl = curl_init();
        if(stripos($url,"https://")!==FALSE){
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
        //增加代理
        //curl_setopt($oCurl, CURLOPT_PROXY, HTTP_PROXY_IP_PORT);
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        curl_close($oCurl);
        if(intval($aStatus["http_code"])==200){
            return $sContent;
        }else{
            return false;
        }
    }</code>
Copy after login

file_get_contents

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template