0

I am trying to implement flight booking API using PHP REST API. If one of my POST Parameters contains character '+' it gets converted to ' ' instead of passing it correctly.. The code I am using is :

    $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);
NightOwl
  • 329
  • 2
  • 20

0 Answers0