Jump to content
Sign in to follow this  

CURLOPT_URL Formatting with "()"

Recommended Posts

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, '');

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, ' startswith +1214820)'); 


Thanks in advance.

Edited by knowramphp

Share this post

Link to post
Share on other sites

Construct a valid URL with something like http_build_query:

curl_setopt($ch, CURLOPT_URL, '' . http_build_query(['query' => '(dtmfaccessid startswith +1214820)']));

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.