I'm writing a php application that submits via curl data to sign up for an iContact email list. However I keep getting an invalid email address error. I think this may be due to the fact that I'm escaping the @ symbol so it looks like %40 instead of @. Also, according to the php documentation for curl_setopt with CURLOPT_POSTFIELDS:
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path.
So, is there anyway to pass the @ symbol as post data through curl in php without running it through urlencode first?
Use
http_build_query()
on your data-array first before passing it tocurl_setopt()
, that will lead to it sending the form asapplication/x-www-form-encoded
instead ofmultipart/form-data
(and thus the @ is not interpreted).Also why do you really care about the @ in an email-address? It only matters if the @ is the first character, not somewhere in the middle.