1

I'm working on InfusionSoft API (documentation here) and making request by using CURL (no API SDK) but getting the following error.

Failed to parse XML-RPC request: Premature end of file.

any help would be appreciated. Below is the CURL code that I'm using.

$url_token = 'http://api.infusionsoft.com/crm/xmlrpc/v1/?access_token='.$access_token;

$curlPost = array(
                'access_token' => $access_token,
                'privateKey' => $api_key,
                'contactId' => 6171,
                'selectedFields' => array('email')
            );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($curlPost));
$res = curl_exec($ch);
echo $res;
Muaaz Khalid
  • 2,199
  • 2
  • 28
  • 51
  • The API seems to be an XML API and you're passing it JSON. Maybe I'm misunderstanding your question... – pendo Aug 09 '18 at 20:25
  • There is already documentation, with code examples for their PHP library. Does that help? https://developer.infusionsoft.com/docs/xml-rpc/#authentication-request-an-access-token – pendo Aug 09 '18 at 20:33

0 Answers0