sending xml data using curl

Hi I am having with problem, I receive connection time out error while running this script, can someone assist me ?


    $strParams          = '';
    $strAPIname         = 'CordecAPI';
    $url                = '';

    $xml = '<?xml version="1.0" encoding="UTF-8"?>
                <JobRequest xmlns="">
                  <DriverNotes>Please wait at reception.</DriverNotes>
                  <OperatorNotes>Test job for CNI.</OperatorNotes>
                      <Passenger>Fara Arani</Passenger>
                      <Address>Cordic Ltd, 1 Rowles Way, Swavesey, Cambridge</Address>
                      <Postcode>CB24 4UG</Postcode>
                      <Address>Heathrow Airport, Terminal 4</Address>
                      <Postcode>TW6 3GA</Postcode>

            $soap_do = curl_init(); 
            curl_setopt($soap_do, CURLOPT_URL,            $url ); 
            curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/');         
            curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); 
            curl_setopt($soap_do, CURLOPT_TIMEOUT,        10); 
            curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
            curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);  
            curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); 
            curl_setopt($soap_do, CURLOPT_POST,           true ); 
           curl_setopt($soap_do, CURLOPT_POSTFIELDS,    $xml); 
           curl_setopt($soap_do, CURLOPT_HTTPHEADER,     array('Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($xml) )); 
          //curl_setopt($soap_do, CURLOPT_USERPWD, $user . ":" . $password);

          $result = curl_exec($soap_do);
          $err = curl_error($soap_do);
          $inf = curl_getinfo($soap_do);            
                echo "CURL FAIL: $url TIMEOUT=10, CURL_ERRNO=$err";
                echo PHP_EOL . '<pre>' . PHP_EOL;
                echo PHP_EOL . '</pre>' . PHP_EOL;
          echo $result;
          echo $err;

if you have some example in soap please do share with me, but I am easy with the curl methods

Thanks !

Source: xml

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.