Location: PHPKode > scripts > rds classes > rds-classes/class.qbrds.inc
<?php

/*
$Id: class.qbrds.inc, v 0.8 2004/06/23

Quickbooks RDS PHP Client

Copyright (c) 2004 Transactional Web, Inc.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

If you have any questions or comments, please email:

Earle West
hide@address.com
http://www.transactionalweb.com

Transactional Web, Inc.
http://www.nusphere.com
http://www.transactionalweb.com

*/

// Extends nusoap by Dietrich Ayala as described below.

include('nusoap.php');
/*

NuSOAP - Web Services Toolkit for PHP

If you have any questions or comments, please email:

Dietrich Ayala
hide@address.com
http://dietrich.ganx4.com/nusoap

NuSphere Corporation
http://www.nusphere.com

*/

class rds extends soapclient {
	var $client;
	var $connectionparameters;
	var $inputqbxml;
	var $outputxml;
	var $status;

function rds($instanceparameters,$qbxml) {

	$this->connectionparameters = $instanceparameters;
	$this->soap_defencoding = "UTF-8";
	$this->inputqbxml = $qbxml;
	$this->ip = "xxx.xxx.xxx.xxx.xxx";
	$this->port = "xxxx";

	$defaultaddress="https://" . $this->ip . ":" . $this->port . "/QBXMLRemote?wsdl";
	$defaultqbFileName="C:\Program Files\Intuit\QuickBooks Pro\sample_service-based business.qbw";
	$defaultoption = "true";
	$defaultloginName = "--rds_login_name_here--";
	$defaultpassword = "--rds_password_here--";
	$defaultappID = "my_web_app_id_whatever";
	$defaultreqFileMod = "dontCare";
	$defaultappName = "my_web_app_name_whatever"";

	if($instanceparameters['address']==''){
		$this->connectionparameters['address'] = $defaultaddress;
		}else{
		$this->connectionparameters['address'] = $instanceparameters['address'];
		}
	if($instanceparameters['qbFileName']==''){
		$this->connectionparameters['qbFileName'] = $defaultqbFileName;
		}else{
		$this->connectionparameters['qbFileName'] = $instanceparameters['qbFileName'];
		}
	if($instanceparameters['option']==''){
		$this->connectionparameters['option'] = $defaultoption;
		}else{
		$this->connectionparameters['option'] = $instanceparameters['option'];
		}
	if($instanceparameters['loginName']==''){
		$this->connectionparameters['loginName'] = $defaultloginName;
		}else{
		$this->connectionparameters['loginName'] = $instanceparameters['loginName'];
		}
	if($instanceparameters['password']==''){
		$this->connectionparameters['password'] = $defaultpassword;
		}else{
		$this->connectionparameters['password'] = $instanceparameters['password'];
		}
	if($instanceparameters['appID']==''){
		$this->connectionparameters['appID'] = $defaultappID;
		}else{
		$this->connectionparameters['appID'] = $instanceparameters['appID'];
		}
	if($instanceparameters['reqFileMod']==''){
		$this->connectionparameters['reqFileMod'] = $defaultreqFileMod;
		}else{
		$this->connectionparameters['reqFileMod'] = $instanceparameters['reqFileMod'];
		}
	if($instanceparameters['appName']==''){
		$this->connectionparameters['appName'] = $defaultappName;
		}else{
		$this->connectionparameters['appName'] = $instanceparameters['appName'];
		}
	$this->soapclient($this->connectionparameters['address'], true);


	//Uncomment the print statements to help debug
	//print "connectionparameters:\n";
	//print_r($this->connectionparameters);

	$qbticket= $this->call('OpenConnectionAndBeginSession', $this->connectionparameters);
	$result = $this->call('ProcessRequest', array('inputRequest' => $qbxml, 'instance' => $qbticket));
	//print "Raw ProcessRequest result:\n";
	//print_r($result);
	//print "\n\n";
	//print "CLIENT REQEST -- Content:\n";
	//print html_entity_decode($this->request);
	//print "\n\n";
	//print "CLIENT RESPONSE-- Content:\n";
	//print html_entity_decode($this->response);
	$this->outputxml = html_entity_decode($this->response);

	$closeresult = $this->call('CloseConnection', array('instance' => $qbticket));
	//return ($this->outputxml);
}
}


//here is the test harnass

// get some xml content
      $qf = fopen("testfile.xml","r");
      $qbXML = fread($qf,100000);
// process the request
	$parameters = array();
	$i = new rds($parameters,$qbXML);

?>

Return current item: rds classes