Home > Backend Development > PHP Tutorial > When initiating curl request in php, get query string problem

When initiating curl request in php, get query string problem

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-09-14 09:41:22
Original
1062 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
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