PHP Example
An example using cURL. This will simply show the first client from your account.
$url = 'https://api.quickfile.co.uk/xml';
$accountNo = '1234567890';
$appID = 'abc-12345-def';
$subNo = '12345678abcd';
$apiKey = 'ABC-DEF-GHI';
$data = '<Client_Search xmlns="http://www.QuickFile.co.uk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.QuickFile.co.uk http://www.quickfile.co.uk/WebServices/API/Schemas/invoices/Client_Search.xsd">
<Header>
<MessageType>Request</MessageType>
<TestMode>false</TestMode>
<SubmissionNumber>'.$subNo.'</SubmissionNumber>
<Authentication>
<AccNumber>'.$accountNo.'</AccNumber>
<MD5Value>'.md5($accountNo.$apiKey.$subNo).'</MD5Value>
<ApplicationID>'.$appID.'</ApplicationID>
</Authentication>
</Header>
<Body>
<SearchParameters>
<ReturnCount>1</ReturnCount>
<Offset>0</Offset>
<OrderResultsBy>CompanyName</OrderResultsBy>
<OrderDirection>ASC</OrderDirection>
</SearchParameters>
</Body>
</Client_Search>';
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
$result = curl_exec($ch);
if($result === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
echo 'Curl successful!';
}
curl_close($ch);
Note: This is omitting the ‘https’ protocol, and using the ‘http’ protocol. While trying to use HTTPS, I ran into an error, and had to add this line to the cURL:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);