PHP code example of asimlqt / netsuite-rest-api-php

1. Go to this page and download the library: Download asimlqt/netsuite-rest-api-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/ */

    

asimlqt / netsuite-rest-api-php example snippets


$factory = new NetsuiteRestApi\NetsuiteClientFactory(
    $companyUrl,
    $accountId,
    $consumerKey,
    $consumerSecret,
    $tokenId,
    $tokenSecret
);

$client = $factory->create();

try {
    $response = $client->customer->get('1234');
} catch (ApiException $e) {
    echo $e->getMessage();
}

try {
    $cursor = $client->currency->list();
    foreach ($cursor as $item) {
        echo $item['id'];
    }
} catch (ApiException $e) {
    echo $e->getMessage();
}

$cursor = $client->currency->list(['limit' => 3]);

 $cursor = $client->customer->list(['limit' => 10]);
 foreach (new LimitIterator($cursor, 0, 10) as $item) {
    ...
 }