PHP code example of ryanwinchester / netsuite-php

1. Go to this page and download the library: Download ryanwinchester/netsuite-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ryanwinchester / netsuite-php example snippets


// Token-based Authentication
;

$config = [
    //     => "https://webservices.netsuite.com",
    "account"        => "MYACCT1",
    "consumerKey"    => "0123456789ABCDEF",
    "consumerSecret" => "0123456789ABCDEF",
    "token"          => "0123456789ABCDEF",
    "tokenSecret"    => "0123456789ABCDEF",
    // optional -------------------------------------
    "signatureAlgorithm" => 'sha256', // Defaults to 'sha256'
    "logging"  => true,
    "log_path" => "/var/www/myapp/logs/netsuite",
    "log_format"     => "netsuite-php-%date-%operation",
    "log_dateformat" => "Ymd.His.u",
];
$service = new NetSuiteService($config);

// Allowing the client to infer configuration from $_ENV
ervice();

// Recommended: Use your own defined data center URL (or sandbox, for instance):
$config['host'] = 'https://123456789.suitetalk.api.netsuite.com';

// To allow the service to get the correct URL for your account on the fly,
// use the legacy webservices url.
$config['host'] = 'https://webservices.netsuite.com';

// Set a logging path
$service->setLogPath('/path/to/logs');

// Turn logging on
$service->logRequests(true);  // Turn logging on.

// Turn logging off
$service->logRequests(false); // Turn logging off.

composer