如何使用PHP curl从ZOHO books API获取JSON数据?

时间:2018-06-09 19:20:59

标签: php curl zoho zohobooks

我只想使用php curl

获取地址中的所有联系人数据

1 个答案:

答案 0 :(得分:0)

来自docs

<?php

              header("Content-type: application/xml");
              $token="AUTHTOKEN";
              $url = "https://crm.zoho.com/crm/private/xml/Leads/getRecords";
              $param= "authtoken=".$token."&scope=crmapi";
              $ch = curl_init();
              curl_setopt($ch, CURLOPT_URL, $url);
              curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_TIMEOUT, 30);
              curl_setopt($ch, CURLOPT_POST, 1);
              curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
              $result = curl_exec($ch);
              curl_close($ch);
              echo $result;
              return $result;

?>