我正在尝试使用PHP REST API实施航班预订API。如果我的一个POST参数包含字符' +'它被转换为' '而不是正确传递..我使用的代码是:
$RequestUrl = "http://demourl";
$RequestXml = '<Bookingrequest>
<details></details>
<key>Rg+0U0MHk4j4XRiFoKIn0f2tg</key>
</Bookingrequest>';
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $RequestUrl);
curl_setopt($ch, CURLOPT_POST, true );
// Passing parameters as xml
curl_setopt($ch, CURLOPT_POSTFIELDS,"xmlRequest=" . $RequestXml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
$data = curl_exec($ch);
curl_close($ch);