<bdo id='rXTVy'></bdo><ul id='rXTVy'></ul>
      1. <i id='rXTVy'><tr id='rXTVy'><dt id='rXTVy'><q id='rXTVy'><span id='rXTVy'><b id='rXTVy'><form id='rXTVy'><ins id='rXTVy'></ins><ul id='rXTVy'></ul><sub id='rXTVy'></sub></form><legend id='rXTVy'></legend><bdo id='rXTVy'><pre id='rXTVy'><center id='rXTVy'></center></pre></bdo></b><th id='rXTVy'></th></span></q></dt></tr></i><div id='rXTVy'><tfoot id='rXTVy'></tfoot><dl id='rXTVy'><fieldset id='rXTVy'></fieldset></dl></div>

      2. <legend id='rXTVy'><style id='rXTVy'><dir id='rXTVy'><q id='rXTVy'></q></dir></style></legend>
      3. <small id='rXTVy'></small><noframes id='rXTVy'>

        <tfoot id='rXTVy'></tfoot>

        使用 php 在 netsuite 中实现 Oauth

        时间:2023-07-16

        1. <legend id='iTrfk'><style id='iTrfk'><dir id='iTrfk'><q id='iTrfk'></q></dir></style></legend>

            <small id='iTrfk'></small><noframes id='iTrfk'>

            <tfoot id='iTrfk'></tfoot>
              • <bdo id='iTrfk'></bdo><ul id='iTrfk'></ul>
                • <i id='iTrfk'><tr id='iTrfk'><dt id='iTrfk'><q id='iTrfk'><span id='iTrfk'><b id='iTrfk'><form id='iTrfk'><ins id='iTrfk'></ins><ul id='iTrfk'></ul><sub id='iTrfk'></sub></form><legend id='iTrfk'></legend><bdo id='iTrfk'><pre id='iTrfk'><center id='iTrfk'></center></pre></bdo></b><th id='iTrfk'></th></span></q></dt></tr></i><div id='iTrfk'><tfoot id='iTrfk'></tfoot><dl id='iTrfk'><fieldset id='iTrfk'></fieldset></dl></div>

                    <tbody id='iTrfk'></tbody>

                  本文介绍了使用 php 在 netsuite 中实现 Oauth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我尝试使用 PHP Toolkit 通过帐户 ID、用户名和密码访问 Netsuite.我可以使用上述凭据获取客户详细信息.我有访问令牌.但是现在我尝试使用访问令牌访问 Netsuite.我需要 PHP 代码才能使用令牌访问 Netsuite,我想获取客户详细信息.

                  I have tried to access Netsuite by account id, username and password using PHP Toolkit. And I can get customer details using the above credentials. i have access token. But Now I tried to access Netsuite using the access token. I need PHP code to access Netsuite using token and I want to get customer details.

                  提前致谢

                  推荐答案

                  这是我为 PHP 编写的一些代码 -> 使用 Restlets 和 OAuth 的 NS 集成:

                  Here is some code I wrote for a PHP -> NS integration using Restlets and OAuth:

                  define("NETSUITE_URL", 'https://rest.netsuite.com/app/site/hosting/restlet.nl');
                  define("NETSUITE_SCRIPT_ID", 'XXXXXX');
                  define("NETSUITE_DEPLOY_ID", 'XXXXXX');
                  define("NETSUITE_ACCOUNT", 'XXXXXX');
                  define("NETSUITE_CONSUMER_KEY", 'XXXXXX');
                  define("NETSUITE_CONSUMER_SECRET", 'XXXXXX');
                  define("NETSUITE_TOKEN_ID", 'XXXXXX');
                  define("NETSUITE_TOKEN_SECRET", 'XXXXXX');
                  
                  function sendOrderToNS($details) {
                      $data_string = json_encode($details);
                  
                      $oauth_nonce = md5(mt_rand());
                      $oauth_timestamp = time();
                      $oauth_signature_method = 'HMAC-SHA1';
                      $oauth_version = "1.0";
                  
                      $base_string =
                          "POST&" . urlencode(NETSUITE_URL) . "&" .
                          urlencode(
                              "deploy=" . NETSUITE_DEPLOY_ID
                            . "&oauth_consumer_key=" . NETSUITE_CONSUMER_KEY
                            . "&oauth_nonce=" . $oauth_nonce
                            . "&oauth_signature_method=" . $oauth_signature_method
                            . "&oauth_timestamp=" . $oauth_timestamp
                            . "&oauth_token=" . NETSUITE_TOKEN_ID
                            . "&oauth_version=" . $oauth_version
                            . "&realm=" . NETSUITE_ACCOUNT
                            . "&script=" . NETSUITE_SCRIPT_ID
                          );
                      $sig_string = urlencode(NETSUITE_CONSUMER_SECRET) . '&' . urlencode(NETSUITE_TOKEN_SECRET);
                      $signature = base64_encode(hash_hmac("sha1", $base_string, $sig_string, true));
                  
                      $auth_header = "OAuth "
                          . 'oauth_signature="' . rawurlencode($signature) . '", '
                          . 'oauth_version="' . rawurlencode($oauth_version) . '", '
                          . 'oauth_nonce="' . rawurlencode($oauth_nonce) . '", '
                          . 'oauth_signature_method="' . rawurlencode($oauth_signature_method) . '", '
                          . 'oauth_consumer_key="' . rawurlencode(NETSUITE_CONSUMER_KEY) . '", '
                          . 'oauth_token="' . rawurlencode(NETSUITE_TOKEN_ID) . '", '  
                          . 'oauth_timestamp="' . rawurlencode($oauth_timestamp) . '", '
                          . 'realm="' . rawurlencode(NETSUITE_ACCOUNT) .'"';
                  
                      $ch = curl_init();
                      curl_setopt($ch, CURLOPT_URL, NETSUITE_URL . '?&script=' . NETSUITE_SCRIPT_ID . '&deploy=' . NETSUITE_DEPLOY_ID . '&realm=' . NETSUITE_ACCOUNT);
                      curl_setopt($ch, CURLOPT_POST, "POST");
                      curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
                      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                      curl_setopt($ch, CURLOPT_HTTPHEADER, [
                          'Authorization: ' . $auth_header,
                          'Content-Type: application/json',
                          'Content-Length: ' . strlen($data_string)
                      ]);
                  
                      curl_exec($ch);
                      curl_close($ch);
                  }
                  

                  这篇关于使用 php 在 netsuite 中实现 Oauth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:尝试在 Mac OS Lion 上的 MAMP 中使用 PECL 安装 OAUTH 时遇到问题 下一篇:如何将 Laravel Passport 与密码授予令牌一起使用?

                  相关文章

                    <bdo id='ozd7g'></bdo><ul id='ozd7g'></ul>
                  <tfoot id='ozd7g'></tfoot>
                • <legend id='ozd7g'><style id='ozd7g'><dir id='ozd7g'><q id='ozd7g'></q></dir></style></legend>

                      <i id='ozd7g'><tr id='ozd7g'><dt id='ozd7g'><q id='ozd7g'><span id='ozd7g'><b id='ozd7g'><form id='ozd7g'><ins id='ozd7g'></ins><ul id='ozd7g'></ul><sub id='ozd7g'></sub></form><legend id='ozd7g'></legend><bdo id='ozd7g'><pre id='ozd7g'><center id='ozd7g'></center></pre></bdo></b><th id='ozd7g'></th></span></q></dt></tr></i><div id='ozd7g'><tfoot id='ozd7g'></tfoot><dl id='ozd7g'><fieldset id='ozd7g'></fieldset></dl></div>
                    1. <small id='ozd7g'></small><noframes id='ozd7g'>