Home >Backend Development >PHP Tutorial >When initiating curl request in php, get query string problem
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? ?
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>