tags:

views:

28

answers:

1

I have a PHP CURL query which is of the form curl -u emailid:password -H "Content-Type: application/xml" -d "[email protected] Details" -X POST http://url/xxx.xml

The query works fine for all email addresses except those that have &, ? or . where I get an xml query format error.

When I replace & with & the & problem is solved. However, I am unable to find a replacement for ? and . I tried the replacements ? for ? and &#x2e for . but I still get an error.

+1  A: 

the -d parameter is expected to be url encoded (not xml-encoded). So ? will be %3f; and . will be %2e.

The fact that & actually worked is somewhat surprising -- it really should be encoded as %26 instead.

Lee