Return to Snippet

Revision: 29033
at July 20, 2010 04:23 by iloveitaly


Initial Code
protected function getNetsuiteConnection() {
	if(empty($this->netsuiteConnection)) {
		// setup the netsuite connection
		ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.SYSPATH.'vendor/netsuite');

		require SYSPATH."vendor/netsuite/PHPtoolkit.php";
		require SYSPATH."vendor/netsuite/directory_v2009.2.php";

		$this->netsuiteConnection = new nsClient(nsHost::live);

		// set request level credentials. (email, password, account#, internal id of role)
		$this->netsuiteConnection->setPassport(
			Kohana::config('netsuite_email'),
			Kohana::config('netsuite_password'),
			Kohana::config('netsuite_account'),
			Kohana::config('netsuite_role')
		);
	}
	
	return $this->netsuiteConnection;
}

Initial URL


Initial Description
Method can that easily used in a PHP class to generate a connection to netsuite. The method below is built using the Kohana library.

Initial Title
Get Netsuite Connection

Initial Tags


Initial Language
PHP