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 ?

<?php 

    #parameters
    $strParams          = '';
    $strAPIname         = 'CordecAPI';
    $url                = 'http://86.17.13.109:81/Webbooker';

    $xml = '<?xml version="1.0" encoding="UTF-8"?>
            <SOAPENV:Envelope 
            xmlns:SOAPENV="http://www.w3.org/2003/05/soap-envelope" 
            xmlns:SOAPENC="http://www.w3.org/2003/05/soap-encoding" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
              <SOAPENV:Body>
                <JobRequest xmlns="http://81.105.223.86:80/cni">
                  <SourceSystem>KVCARS</SourceSystem>
                  <SourcePassword>Ketchup96</SourcePassword>
                  <SourceJobID>*KV001*</SourceJobID>
                  <SourceAccount>CORDIC</SourceAccount>
                  <TargetSystem>TARGET1</TargetSystem>
                  <Lifetime>60</Lifetime>
                  <DriverNotes>Please wait at reception.</DriverNotes>
                  <OperatorNotes>Test job for CNI.</OperatorNotes>
                  <BookerName>Jane</BookerName>
                  <BookerPhone>01954233255</BookerPhone>
                  <BookerEmail>jane.test@cordic.com</BookerEmail>
                  <StopList>
                    <Stop>
                      <Order>1</Order>
                      <Passenger>Fara Arani</Passenger>
                      <Address>Cordic Ltd, 1 Rowles Way, Swavesey, Cambridge</Address>
                      <Postcode>CB24 4UG</Postcode>
                      <ContactPhone>01954233255</ContactPhone>
                      <ContactOnArrive>Ring</ContactOnArrive>
                    </Stop>
                    <Stop>
                      <Order>2</Order>
                      <Address>Heathrow Airport, Terminal 4</Address>
                      <Postcode>TW6 3GA</Postcode>
                    </Stop>
                  </StopList>
                  <AttributeList>
                    <Attribute>Executive</Attribute>
                    <Attribute>Professional</Attribute>
                  </AttributeList>
                </JobRequest>
              </SOAPENV:Body>
            </SOAPENV:Envelope>';

            $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:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');         
            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);            
          if(!$result)
             {
                echo "CURL FAIL: $url TIMEOUT=10, CURL_ERRNO=$err";
                echo PHP_EOL . '<pre>' . PHP_EOL;
                var_dump($inf);
                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