Hi jpaide
Here is the, sanitized, code that I'm using :-
<?php
set_include_path('.:/ /htdocs/PEAR/');
require_once " /htdocs/PEAR/HTTP/Request.php";
require_once /htdocs/PEAR/PEAR.php";
PEAR::setErrorHandling(PEAR_ERROR_DIE);
if(isset($_POST['create_xml'])){
/* All Links data from the form is now being stored in variables in string format */
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$streetnumber = $_POST['streetnumber'];
$title = $_POST['title'];
$postcode = $_POST['postcode'];
$country = $_POST['country'];
$since = $_POST['since'];
$DoBday = $_POST['DoBday'];
$DoBmonth = $_POST['DoBmonth'];
$DoByr = $_POST['DoByr'];
$passdrive = $_POST['passdrive'];
$refno = $_POST['refno'];
$CrqDateTime=str_replace('%',substr(microtime(),2,7),date('Y-m-d\TH:i:s.%O'));
$CrqDateTime=substr($CrqDateTime,0,-2).':'.substr($CrqDateTime,-2);
$CrqDocName=str_replace('%',substr(microtime(),2,7),date('Y-m-d\TH-i-s-%O'));
$CrqDocName=substr($CrqDocName,0,-2).'-'.substr($CrqDocName,-2);
$urlDoc = $CrqDocName;
$DoBtime = "T00:00:00.0000000+01:00";
$url = "
http://ws.website.co.uk/Search.asmx" ;
$CrqTestRequest = "Test";
$CrqService = "searching";
$CrqCompanyID = "me";
$CrqUserID = "MeAPI";
$CrqSearchID = "ID0001";
$CrqPassword = "abc1234";
$CrqClientRef = "TESTREF0001";
$xmlBeg1 = '<?xml version="1.0" encoding="utf-8"?>';
$xmlBeg2 = '<soap:Envelope xmlns:xds="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-
instance" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">';
$xmlBeg4 = '<PerformCheck xmlns="
http://website.co.uk/search/V2.0">';
$CrqIntegratorID ="glo1";
$xml_document= $xmlBeg1;
$xml_document .= $xmlBeg2;
$xml_document .= "<soap:Body>";
$xml_document .= $xmlBeg4;
$xml_document .= "<CallRequest>";
$xml_document .= "<CrqIntegratorId>";
$xml_document .= $CrqIntegratorID;
$xml_document .= "</CrqIntegratorId>";
$xml_document .= "<CrqTestRequest>";
$xml_document .= $CrqTestRequest;
$xml_document .= "</CrqTestRequest>";
$xml_document .= "<CrqDateTime>";
$xml_document .= $CrqDateTime;
$xml_document .= "</CrqDateTime>";
$xml_document .= "<CrqService>";
$xml_document .= $CrqService;
$xml_document .= "</CrqService>";
$xml_document .= "<CrqCompanyID>";
$xml_document .= $CrqCompanyID;
$xml_document .= "</CrqCompanyID>";
$xml_document .= "<CrqUserID>";
$xml_document .= $CrqUserID;
$xml_document .= "</CrqUserID>";
$xml_document .= "<CrqPassword>";
$xml_document .= $CrqPassword;
$xml_document .= "</CrqPassword>";
$xml_document .= "<CrqSearchId>";
$xml_document .= $CrqSearchID;
$xml_document .= "</CrqSearchId>";
$xml_document .= "<CrqClientRef>";
$xml_document .= $CrqClientRef;
$xml_document .= "</CrqClientRef>";
$xml_document .= "<CrqApplicant>";
$xml_document .= "<AptName>";
$xml_document .= "<Surname>";
$xml_document .= $lastName;
$xml_document .= "</Surname>";
$xml_document .= "<Forename>";
$xml_document .= $firstName;
$xml_document .= "</Forename>";
$xml_document .= "<Title>";
$xml_document .= $title;
$xml_document .= "</Title>";
$xml_document .= "</AptName>";
$xml_document .= "<AptAddress>";
$xml_document .= "<AadBuilding>";
$xml_document .= $streetnumber;
$xml_document .= "</AadBuilding>";
$xml_document .= "<AadStreet>";
$xml_document .= $address1;
$xml_document .= "</AadStreet>";
$xml_document .= "<AadPostTown>";
$xml_document .= $address2;
$xml_document .= "</AadPostTown>";
$xml_document .= "<AadPostcode>";
$xml_document .= $postcode;
$xml_document .= "</AadPostcode>";
$xml_document .= "</AptAddress>";
$xml_document .= "<AptDOB>";
$xml_document .= "<Date>";
$xml_document .= $DoByr."-". $DoBmonth."-". $DoBday. $DoBtime;
$xml_document .= "</Date>";
$xml_document .= "</AptDOB>";
$xml_document .= "</CrqApplicant>";
$xml_document .= "</CallRequest>";
$xml_document .= "</PerformMLCheck>";
$xml_document .= "</soap:Body>";
$xml_document .= "</soap:Envelope>";
$doc_document= $title;
$doc_document .= $firstName;
$doc_document .= $lastName;
$doc_document .= $streetnumber;
$doc_document .= $address1;
$doc_document .= $address2;
$doc_document .= $postcode;
$doc_document .= $country;
$path_dir = "output/";
$doc_path_dir = "output/";
$results_path_dir = "output/";
$path_dir .= $urlDoc .".xml";
$doc_path_dir .= $urlDoc .".doc";
$results_path_dir .= $urlDoc ."-RESULTS.xml";
/* START Send RAW data */
$req =& new HTTP_Request($url);
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addHeader('POST',' /Search.asmx HTTP/1.1');
$req->addHeader('Host','ws.website.co.uk');
$req->addHeader('Content-Type','text/xml; charset=utf-8');
$req->addHeader('ContentLength',strlen($xml_document));
$req->addHeader('SOAPAction','"
http://website.co.uk/search/V2.0/PerformCheck"');
$req->SetBody($xml_document);
$req->sendRequest();
$results=$req->getResponseBody();
$xmlResponse = simplexml_load_string($req->getResponseBody());
$xmlresults = SimpleXml_Load_String($req->getResponseBody());
$ChyType = (string)$xmlresults->CallResponse->AcdCreditHistory->ChyType;
//echo $xmlResponse -> asXML();
/* END Send RAW data */
/* Data in Variables ready to be written to an XML file */
$fp = fopen($path_dir,'w');
$write = fwrite($fp,$xml_document);
fclose($fp);
/* Data in Variables ready to be written to an DOC file */
$fp = fopen($doc_path_dir,'w+');
$write = fwrite($fp,$doc_document);
fclose($fp);
/* Response to be written to an XMl file */
$fp = fopen($results_path_dir,'w+');
$write = fwrite($fp,$results);
fclose($fp);
$fh = fopen($results_path_dir, "r") or exit("Unable to open file!");
$file = file_get_contents($results_path_dir);
echo $file;
$type = "n";
$used = "n";
if($file->$chyType == $type && $file->$chyused == $used) {
header('Location:
www.yahoo.co.uk');
} elseif ($file->$chyType != $type && $file->$chyused != $used) {
header('Location:
www.google.co.uk');
} elseif ($file->$chyType == $type && $file->$chyused != $used) {
header('Location:
www.ask.co.uk');
} else{
header('Location:
www.bing.co.uk');
}
if (PEAR::isError($result)) {
echo $result->getMessage();
} else {
}
}
?>
Thanks