knowramphp Posted March 30, 2017 Share Posted March 30, 2017 (edited) I am having trouble getting a Curl script to work for a GET request. if I use the following as the URL everything works. curl_setopt($ch, CURLOPT_URL, 'https://10.10.10.10/vmrest/users'); However if I try and add a query to filter out the results I get an error 505. Is there anything different I have to do to get CURLOPT_URL to format correctly when using the brackets and spaces? curl_setopt($ch, CURLOPT_URL, 'https://10.10.10.10/vmrest/users?query=(dtmfaccessid startswith +1214820)'); Thanks in advance. Edited March 30, 2017 by knowramphp Quote Link to comment https://forums.phpfreaks.com/topic/303581-curlopt_url-formatting-with/ Share on other sites More sharing options...
Solution requinix Posted March 30, 2017 Solution Share Posted March 30, 2017 Construct a valid URL with something like http_build_query: curl_setopt($ch, CURLOPT_URL, 'https://10.10.10.10/vmrest/users?' . http_build_query(['query' => '(dtmfaccessid startswith +1214820)'])); Quote Link to comment https://forums.phpfreaks.com/topic/303581-curlopt_url-formatting-with/#findComment-1544829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.