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

如何使用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}'

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用PHP和SQL访问Zoho Books中的数据,但我不知道第一步。 我理解PHP和SQL,但需要有关如何检索Zoho数据的帮助。 非常感谢任何帮助。

我已经对Zoho进行了大量研究,但我一直都知道需要一个API来访问这些数据。 有关API的信息导致需要使用cURL,这似乎需要Composer。 所有这一切应该如何融合在我的脑海中仍然不明确。 任何有经验的人都可以亲切地展示这一切是如何运作的吗?

理想情况下,我希望能够查询Zoho并能够撤回符合我标准的记录。 这是我缺少的关键。 我已经知道操作数据并将其上传到MySQL所需的代码。

编辑:我安装了composer,但似乎无法找到比1.7更新的任何cURL版本。

我知道如何获得通过后端访问Zoho的密钥。 我只是缺少要实现的语法。

EG,将执行以下调用:

$ curl https://books.zoho.com/api/v3/organizations?organization_id=10234695 -H'授权:Zoho-authtoken { 秘密令牌}'

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

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);
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题