douzhaishan5462 2019-01-17 21:40
浏览 61
已采纳

如何使用PHP访问ZohoBooks中的数据

I am trying to access data in Zoho Books using PHP and SQL, but I do not know the first step. I understand PHP and SQL, but need assistance in how to retrieve Zoho's data. Any assistance would be greatly appreciated.

I have done a fair amount of research into Zoho, but I keep getting informed there is need of an API to access this data. Information on the API leads to the need to use cURL, which appears to require Composer. How all of this is supposed to fit together is still not clear in my mind. Could anyone with more experience kindly show how this all works?

Ideally I would like to be able to query Zoho and be able to withdraw whichever records meet my criteria. This is the key I am missing. I already know the code necessary to manipulate the data and upload it into MySQL.

Edit: I have composer installed, but it seems unable to locate any versions of cURL newer than 1.7.

I know how to get a key to access Zoho through the backend. I am simply missing the syntax to implement.

EG, where would the following call be implemented:

$ curl https://books.zoho.com/api/v3/organizations?organization_id=10234695 -H 'Authorization: Zoho-authtoken {secret token}'

  • 写回答

1条回答 默认 最新

  • dqst96444 2019-01-17 22:23
    关注

    From https://incarnate.github.io/curl-to-php/, if you paste in:

    curl https://books.zoho.com/api/v3/organizations?organization_id=10234695 -H 'Authorization: Zoho-authtoken {secret token}'
    

    Output PHP (obviously replace {secret token}):

    // Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, 'https://books.zoho.com/api/v3/organizations?organization_id=10234695');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
    
    
    $headers = array();
    $headers[] = 'Authorization: Zoho-authtoken {secret token}';
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    $result = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'Error:' . curl_error($ch);
    }
    curl_close ($ch);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?