When initiating curl request in php, get query string problem

WBOY
Release: 2016-09-14 09:41:22
Original
996 people have browsed it

When using curl to send a get request, can’t there be a query string behind the url? ? ? ? ? ? Why can’t I access the page when I bring it with me? ?

Reply content:

When using curl to send a get request, can’t there be a query string behind the url? ? ? ? ? ? Why can’t I access the page when I bring it with me? ?

The requirements for URL are the same as those of browsers.
You will know what you did only after reading the code.

curl, get and post are all fine. Is there something wrong with your code? Post the code and take a look.

How do you use curl? It’s impossible! Take a look at how your curl_setopt is set up

<code>//必须把$_GET的信息拼接好放到url里面去
 function httpGet($url) {
    $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);
 
    $res = curl_exec($curl);
    curl_close($curl);
    return $res;
 }
 </code>
Copy after login
Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template