Home > Article > Backend Development > Problem with url parameters when php uses curl to initiate get request
When sending a get request, can the url not have a query string, but can only be the domain name + path? My example is as follows. Does it not work after adding the query string? ? ?
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.dest.cn/member/my.php"); //curl_setopt($ch, CURLOPT_URL, "http://www.dest.cn/member/my.php?mid=14&my_calfee=1") curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $kk = curl_exec($ch); curl_close($ch); print_r($kk);
When sending a get request, can the URL not contain a query string, but can only be a domain name + path? My example is as follows. Does it not work after adding the query string? ? ?
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.dest.cn/member/my.php"); //curl_setopt($ch, CURLOPT_URL, "http://www.dest.cn/member/my.php?mid=14&my_calfee=1") curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $kk = curl_exec($ch); curl_close($ch); print_r($kk);
Get is url parameter passing
The above is the content of the url parameter problem when PHP uses curl to initiate a get request. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!
Related articles:
Using curl to send requests (GET requests and POST requests) in PHP
Detailed examples of precautions for using curl function to send Post requests in PHP