J Noel
J Noel

Reputation: 103

Zoho API inserRecord using Curl and XML, not returning an error and not adding the "Potential"

I have been banging my head for days if not weeks. I think this is mostly due to the fact that I am unfamiliar with XML and this particular notion of PHP cURL.

and the client is using french words so the accents are not helping when it goes through Zoho (different story)

Anyways when I write the XML, do I have to input all the fields or just the ones marked as necessary. For example

The "opportunity" has (accountID, ContactID,oppurtunityName, date Due, Mailing,etc)as fields and lets say I didnt want to add mailing or the others, does and the others still need to be there?

I ask this because I just did this:

<?xml version="1.0" encoding="UTF-8" ?>
  <Potentials>
      <row no="1">
          <FL val="ACCOUNTID">accountID is in here</FL>
          <FL val="Potential Name">Potential Name is in here</FL>
          <FL val="Stage">"Perdu"</FL>
          <FL val="Closing Date">01/04/2009</FL>
    </row>
  </Potentials>

and in php

$query = "newFormat=1&authtoken={$authtoken}&scope=crmapi&xmlData={$xmlData->asXML()}";

   $ch = curl_init();
    /* set url to send post request */
    curl_setopt($ch, CURLOPT_URL, $url);
    /* allow redirects */
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    /* return a response into a variable */
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    /* times out after 30s */
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    /* set POST method */
    curl_setopt($ch, CURLOPT_POST, 1);
    /* add POST fields parameters */
    curl_setopt($ch, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl.
    //Execute cUrl session
    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;

and it used to return errors saying the fields do not exist, now after a few fixes it returns nothing and the "opportunity" is not created.

Any help would be greatly appreciated

Thank you .

Upvotes: 1

Views: 633

Answers (1)

Alex Koloskov
Alex Koloskov

Reputation: 231

I had almost the same issue with Zoho like you and was able to resolve it by adding next curl option. Hope this help you too:

curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'rsa_rc4_128_sha');

Upvotes: 2

Related Questions