XML API for PHP
Using the XML API, data in ConcourseSuite CRM can be retrieved using various clients. While a toolset has not been made specifically for PHP, the following has been used to interact with ConcourseSuite CRM and PHP.
In the example, the XML creation is left up to the application to implement, although an XML library is strongly encouraged so that the XML is encoded properly.
<? // Site to post to $server = "www.example.com" $path = "/crm/ProcessPacket.do" // Begin the transfer $socket = fsockopen($server, 80); if (!$socket) { // error: could not connect to server // return } else { // Post the XML document $request = "POST " . $path . " HTTP/1.0\r\n" . "Host: " . $server . "\r\n" . "Content-Type: text/xml\r\n" . "Content-Length: " . strlen($xmlDocument) . "\r\n\r\n" . $xmlDocument; if (!fputs($socket, $request, strlen($request))) { // error: could not write to server // return } $response = ''; while ($data = fread($socket, 32768)) { $response .= $data; } fclose($socket); if ($response = '') { // error: no response from server // return } else { // review the response for status } } ?>
Some things to keep in mind...
- The XML needs to be well-formed
- Errors in the response provide some answers... see the FAQ
Sign in to add your comment.