简体   繁体   English

PHP CURL中的`?`和`.`的替代品是什么

[英]What is the replacement for `?` and `.` in PHP CURL

I have a PHP CURL query which is of the form curl -u emailid:password -H "Content-Type: application/xml" -d "test?@test.comTestTest Details" -X POST http://url/xxx.xml 我有一个PHP CURL查询,其格式为curl -u emailid:password -H“ Content-Type:application / xml” -d“ test?@test.comTestTest 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. 在这里我得到一个xml查询格式错误。

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 . &#x2e . but I still get an error. 但我仍然出现错误。

the -d parameter is expected to be url encoded (not xml-encoded). -d参数应该是url编码的 (不是xml编码的)。 So ? ? will be %3f ; 将为%3f and . . will be %2e . 将为%2e

The fact that & 事实& actually worked is somewhat surprising -- it really should be encoded as %26 instead. 实际工作有点令人惊讶-实际上应该将其编码为%26

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM