<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/views/header.tpl.php'; ?> <pre> <?php // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the IPP version to v3 $IPP->version(QuickBooks_IPP_IDS::VERSION_3); $TimeActivityService = new QuickBooks_IPP_Service_TimeActivity(); $TimeActivity = new QuickBooks_IPP_Object_TimeActivity(); $TimeActivity->setTxnDate('2013-10-10'); $TimeActivity->setNameOf('Vendor'); $TimeActivity->setVendorRef('89'); $TimeActivity->setItemRef('8'); $TimeActivity->setHourlyRate('250'); $TimeActivity->setStartTime(QuickBooks_Utilities::datetime('-5 hours'));
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'app token here'; $realmID = 1234; $appdbid = 'app dbid here'; // $IPP = new QuickBooks_IPP(); if ($Context = $IPP->authenticate($username, $password, $token)) { $IPP->application($appdbid); //$IPP->useDebugMode(true); if ($IPP->assertFederatedIdentity($Context, 'XXXXXod-intuit.ipp.prod', 'https://secure.your-url.com/saml.php')) { print 'SUCCESS!'; } else { print 'Error [' . $IPP->errorCode() . ': ' . $IPP->errorText() . ', ' . $IPP->errorDetail() . ']'; } print "\n\n\n\n"; print $IPP->lastRequest(); print "\n\n\n\n"; print $IPP->lastResponse(); } else { print 'Auth error...?'; }
<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/views/header.tpl.php'; ?> <pre> <?php // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the DBID $IPP->dbid($Context, 'something'); // Set the IPP flavor $IPP->flavor($creds['qb_flavor']); // Get the base URL if it's QBO if ($creds['qb_flavor'] == QuickBooks_IPP_IDS::FLAVOR_ONLINE) { $IPP->baseURL($IPP->getBaseURL($Context, $realm)); } //print('Base URL is [' . $IPP->baseURL() . ']' . "\n\n"); $CustomerService = new QuickBooks_IPP_Service_Customer();
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; // $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application($Context, 'be9mh7qd5'); /* <?xml version="1.0"?> <Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="369c25d94c664b8e801164a6fe87698d"> <ExternalRealmId>179017358</ExternalRealmId> <Object xsi:type="Invoice"> <Header> <DocNumber>DF110108JM</DocNumber> <TxnDate>2011-01-14</TxnDate> <CustomerId>2</CustomerId> <SubTotalAmt>1000</SubTotalAmt> <TaxAmount>0</TaxAmount> <DueDate>2011-02-13</DueDate> <Balance>1000</Balance> <Memo></Memo> </Header> <Line> <Desc>Hope, Bob (Normal Hours) 12/26/2010</Desc>
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application('be9mh7qd5'); $IPP->getAvailableCompanies($Context); print $IPP->lastRequest(); print "\n\n"; print $IPP->lastResponse(); print "\n\n"; exit; $realm = $IPP->getIDSRealm($Context); print 'realm is: {' . $realm . '}'; print "\n\n"; if ($IPP->detachIDSRealm($Context, $realm)) { print 'Detached ' . $realm . '!'; } else { print 'Failed to detach: ' . $IPP->errorNumber() . ': ' . $IPP->errorMessage(); } //print($IPP->lastRequest()); //print($IPP->lastResponse()); print "\n\n"; $realm = $IPP->getIDSRealm($Context);
// Instantiate our Intuit Anywhere auth handler // // The parameters passed to the constructor are: // $dsn // $oauth_consumer_key Intuit will give this to you when you create a new Intuit Anywhere application at AppCenter.Intuit.com // $oauth_consumer_secret Intuit will give this to you too // $this_url This is the full URL (e.g. http://path/to/this/file.php) of THIS SCRIPT // $that_url After the user authenticates, they will be forwarded to this URL // $IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret, $quickbooks_oauth_url, $quickbooks_success_url); // Are they connected to QuickBooks right now? if ($IntuitAnywhere->check($the_username, $the_tenant) and $IntuitAnywhere->test($the_username, $the_tenant)) { // Yes, they are $quickbooks_is_connected = true; // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); if ($sandbox) { // Turn on sandbox mode/URLs $IPP->sandbox(true); } // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database $Context = $IPP->context(); // Get some company info
/** * Test to see if a connection actually works (make sure you haven't been disconnected on Intuit's end) * */ public function test($app_username, $app_tenant) { if ($creds = $this->load($app_username, $app_tenant)) { $IPP = new QuickBooks_IPP(); $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $app_username, $creds); if ($Context = $IPP->context()) { // Set the DBID $IPP->dbid($Context, 'something'); // Set the IPP flavor $IPP->flavor($creds['qb_flavor']); // Get the base URL if it's QBO if ($creds['qb_flavor'] == QuickBooks_IPP_IDS::FLAVOR_ONLINE) { $cur_version = $IPP->version(); $IPP->version(QuickBooks_IPP_IDS::VERSION_3); // Need v3 for this $CustomerService = new QuickBooks_IPP_Service_Customer(); $customers = $CustomerService->query($Context, $creds['qb_realm'], "SELECT * FROM Customer MAXRESULTS 1"); $IPP->version($cur_version); // Revert back to whatever they set //$IPP->baseURL($IPP->getBaseURL($Context, $creds['qb_realm'])); } else { $companies = $IPP->getAvailableCompanies($Context); } //print('[[' . $IPP->lastRequest() . ']]' . "\n\n"); //print('[[' . $IPP->lastResponse() . ']]' . "\n\n"); //print('here we are! [' . $IPP->errorCode() . ']'); // Check the last error code now... if ($IPP->errorCode() == 401 or $IPP->errorCode() == 3200) { return false; } return true; } } return false; }
<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/views/header.tpl.php'; ?> <pre> <?php // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the IPP version to v3 $IPP->version(QuickBooks_IPP_IDS::VERSION_3); $PurchaseService = new QuickBooks_IPP_Service_Purchase(); // Create our Purchase $Purchase = new QuickBooks_IPP_Object_Purchase(); $Line = new QuickBooks_IPP_Object_Line(); $Line->setDescription('Test description'); $Line->setAmount(29.95); $Line->setDetailType('AccountBasedExpenseLineDetail'); $AccountBasedExpenseLineDetail = new QuickBooks_IPP_Object_AccountBasedExpenseLineDetail();
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; $application = 'be9mh7qd5'; // $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application($Context, $application); $IPP->useIDSParser(false); /* $Service = new QuickBooks_IPP_Service_Item(); $Service->findAll($Context, $realmID); print($Service->lastRequest() . "\n\n"); print($Service->lastResponse() . "\n\n"); */ /* $Service = new QuickBooks_IPP_Service_Item(); $Item = new QuickBooks_IPP_Object_Item(); $Item->setType('Service'); $Item->setName('Test Name');
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; // $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application('be9mh7qd5'); //$IPP->useDebugMode(true); //print_r($IPP->sendInvitation($Context, '*****@*****.**')); //print_r($IPP->getAvailableCompanies($Context)); $User = $IPP->getUserInfo($Context); print_r($User); $roles = $IPP->getUserRoles($Context, $User->getUserId()); print_r($roles); $info = $IPP->getDBInfo($Context); print_r($info);
<?php header('Content-Type: text/plain'); ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/Users/kpalmer/Projects/QuickBooks/'); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; // $IPP = new QuickBooks_IPP(); if ($Context = $IPP->authenticate($username, $password, $token)) { $IPP->application($Context, 'be9mh7qd5'); $user = $IPP->getUserInfo($Context); print_r($user); //exit; $Service = new QuickBooks_IPP_Service_Customer(); if ($list = $Service->findAll($Context, $realmID)) { //print_r($list); foreach ($list as $Customer) { print 'Name is [' . $Customer->getName() . ']' . "\n"; } } //print($Service->lastRequest()); //print($Service->lastResponse()); } else { print 'Auth failed!'; }
<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/views/header.tpl.php'; ?> <pre> <?php // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the DBID $IPP->dbid($Context, 'something'); // Set the IPP flavor $IPP->flavor($creds['qb_flavor']); // Get the base URL if it's QBO if ($creds['qb_flavor'] == QuickBooks_IPP_IDS::FLAVOR_ONLINE) { $IPP->baseURL($IPP->getBaseURL($Context, $realm)); } $SyncStatus = new QuickBooks_IPP_Service_SyncStatus(); $id = '{QBO-119}';
protected function _handleSAML($SAML = null) { $this->_log('Starting up (initialized with ' . strlen($SAML) . ' bytes)'); if ($this->_config['test_username'] and $this->_config['test_password']) { $SAML = QUICKBOOKS_IPP_FEDERATOR_TEST_SAML; $private_key_data = QUICKBOOKS_IPP_FEDERATOR_TEST_KEY; } if (!$SAML) { if (!empty($_POST['SAMLResponse'])) { $SAML = base64_decode($_POST['SAMLResponse']); } else { $msg = 'No SAML request in $_POST vars.'; $this->_log($msg); $this->_setError(QuickBooks_IPP_Federator::ERROR_SAML, $msg); return false; } } if (strlen($SAML) > QUICKBOOKS_IPP_FEDERATOR_MAX_SAML_LENGTH) { $msg = 'SAML request seems unusually large, at ' . strlen($SAML) . ' bytes.'; $this->_log($msg); $this->_setError(QuickBooks_IPP_Federator::ERROR_SAML, $msg); return false; } if ($this->_config['test_username'] and $this->_config['test_password']) { // Do nothing, we already fetched our private key data up there ^^^ } else { $fp = fopen($this->_key, 'r'); $private_key_data = fread($fp, 8192); fclose($fp); } // Decode the SAML request if it's base64 encoded if (false === strpos($SAML, '<')) { $SAML = base64_decode($SAML); } $this->_log('Incoming SAML request: ' . substr($SAML, 0, 128) . '...'); $this->_log($SAML, QUICKBOOKS_LOG_DEBUG); //print("\n\n" . $SAML . "\n\n"); // $private_key = openssl_get_privatekey($private_key_data); //$public_key = openssl_get_publickey($__publicKey); $use_backend = QuickBooks_XML_Parser::BACKEND_BUILTIN; $Parser = new QuickBooks_XML_Parser($SAML, $use_backend); if ($Doc = $Parser->parse($errnum, $errmsg)) { $Root = $Doc->getRoot(); $auth_id = $Root->getChildDataAt('samlp:Response saml:Assertion saml:Subject saml:NameID'); $this->_log('Auth ID: [' . $auth_id . ']'); if (!$auth_id) { $this->_setError(QuickBooks_IPP_Federator::ERROR_INTERNAL, 'Could not extract Auth ID from SAML response.'); return false; } /* $AttributeStatement = $Root->getChildAt('samlp:Response saml:Assertion saml:AttributeStatement'); foreach ($AttributeStatement->children() as $Node) { if ($Node->name() == 'saml:Attribute') { $Attribute = $Node; print_r($Attribute); } } exit; */ $encrypted_key = $Root->getChildDataAt('samlp:Response saml:Assertion saml:AttributeStatement saml:EncryptedAttribute xenc:EncryptedData ds:KeyInfo xenc:EncryptedKey xenc:CipherData xenc:CipherValue'); $this->_log('Encrypted key: [' . $encrypted_key . ']'); if (!$encrypted_key) { $this->_setError(QuickBooks_IPP_Federator::ERROR_INTERNAL, 'Could not extract encrypted key from SAML response.'); return false; } $encrypted_ticket = $Root->getChildDataAt('samlp:Response saml:Assertion saml:AttributeStatement saml:EncryptedAttribute xenc:EncryptedData xenc:CipherData xenc:CipherValue'); $this->_log('Encrypted ticket: [' . $encrypted_ticket . ']'); if (!$encrypted_ticket) { $this->_setError(QuickBooks_IPP_Federator::ERROR_INTERNAL, 'Could not extract encrypted ticket from SAML response.'); return false; } // Loop through the nodes, fetching the attributes from the SAML request $Node = $Root->getChildAt('samlp:Response saml:Assertion saml:AttributeStatement'); $target_url = null; $realm_id_pseudonym = null; foreach ($Node->children() as $ChildNode) { if ($ChildNode->name() == 'saml:Attribute') { $Attribute = $ChildNode; if ($Attribute->getAttribute('Name') == 'targetUrl') { $ChildChildNode = $Attribute->getChild(0); $target_url = $ChildChildNode->data(); } else { if ($Attribute->getAttribute('Name') == 'Intuit.Federation.realmIDPseudonym') { $ChildChildNode = $Attribute->getChild(0); $realm_id_pseudonym = $ChildChildNode->data(); } } } } $this->_log('Target URL: [' . $target_url . ']'); $this->_log('Realm ID Pseudonym: [' . $realm_id_pseudonym . ']'); //exit; if (!$target_url) { $this->_setError(QuickBooks_IPP_Federator::ERROR_INTERNAL, 'Could not extract target URL from SAML response.'); return false; } /* // Get the signatureValue $node = $xml->xpath('/samlp:Response/saml:Assertion/ds:Signature/ds:SignatureValue'); $signatureValue = $node[0]; # Get the signed node $signInfo = $xml->xpath('/samlp:Response/saml:Assertion/ds:Signature/ds:SignedInfo'); */ // The key and ticket are base64 encoded, decode them $decoded_key = base64_decode($encrypted_key); $decoded_ticket = base64_decode($encrypted_ticket); // Decrypt the key $decrypted_key = null; $result = $this->_segfault_openssl_private_decrypt($decoded_key, $decrypted_key, $private_key_data); $this->_log('Key: [' . $decrypted_key . ']'); if (!$decrypted_key) { $this->_setError(QuickBooks_IPP_Federator::ERROR_INTERNAL, 'Could not extract decrypted key from SAML response.'); return false; } // @todo Swap out for QuickBooks_Encrypt implementation // Get the key size for decryption $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); // $decoded_ticket is stored as: // 16-byte IV // CONCAT WITH // XX-byte actual encrypted ticket in XML format // Get the IV $iv = substr($decoded_ticket, 0, $iv_size); // This is the actual encrypted ticket $cipher = substr($decoded_ticket, $iv_size); // @todo Swap out for QuickBooks_Encrypt implementation // Decrypt the ticket $decrypted_ticket = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $decrypted_key, $cipher, MCRYPT_MODE_CBC, $iv); // Remove the padding from the ticket $last_byte = substr($decrypted_ticket, -1, 1); $padding = -ord($last_byte); $decrypted_ticket = substr($decrypted_ticket, 0, $padding); $this->_log('Decrypted ticket is ' . strlen($decrypted_ticket) . ' bytes long...'); $this->_log($decrypted_ticket, QUICKBOOKS_LOG_DEBUG); // Parse the XML format to get at the actual ticket value $ticket = null; $errnum = null; $errmsg = null; $use_backend = QuickBooks_XML_Parser::BACKEND_BUILTIN; $Parser = new QuickBooks_XML_Parser($decrypted_ticket, $use_backend); if ($Doc = $Parser->parse($errnum, $errmsg)) { $Root = $Doc->getRoot(); $ticket = $Root->getChildDataAt('Attribute saml:AttributeValue'); $this->_log('Ticket: [' . $ticket . ']'); // Check for test mode overrides if ($this->_config['test_username'] and $this->_config['test_password']) { $username = $this->_config['test_username']; $password = $this->_config['test_password']; $token = 'blablabla'; $test_replace = array('{dbid}' => $this->_config['test_param_dbid'], '{realm}' => $this->_config['test_param_realm'], '{state}' => $this->_config['test_param_state']); $target_url = str_replace(array_keys($test_replace), array_values($test_replace), $this->_config['test_target']); // Grab a ticket $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $ticket = $Context->ticket(); $this->_log('TEST MODE [authid=' . $auth_id . ', ticket=' . $ticket . ', target_url=' . $target_url . ']'); } return $this->_doCallback($auth_id, $ticket, $target_url, $realm_id_pseudonym); } else { $this->_setError(QuickBooks_IPP_Federator::ERROR_XML, 'XML parser error while parsing SAML ticket: ' . $errnum . ':' . $errmsg); return false; } } else { $this->_setError(QuickBooks_IPP_Federator::ERROR_XML, 'XML parser error while parsing SAML response: ' . $errnum . ': ' . $errmsg); return false; } }
<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/views/header.tpl.php'; ?> <pre> <?php // Set up the IPP instance $IPP = new QuickBooks_IPP($dsn); // Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant); // Tell the framework to load some data from the OAuth store $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds); // Print the credentials we're using //print_r($creds); // This is our current realm $realm = $creds['qb_realm']; // Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the IPP version to v3 $IPP->version(QuickBooks_IPP_IDS::VERSION_3); $TermService = new QuickBooks_IPP_Service_Term(); $terms = $TermService->query($Context, $realm, "SELECT * FROM Term"); //print_r($terms); foreach ($terms as $Term) { //print_r($Term); print 'Term Id=' . $Term->getId() . ' is named: ' . $Term->getName() . '<br>'; } /*
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; // $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application('be9mh7qd5'); //$IPP->useDebugMode(true); //print_r($IPP->sendInvitation($Context, '*****@*****.**')); //print_r($IPP->getAvailableCompanies($Context)); $value = 'testvalue' . mt_rand(); $return = $IPP->setDBVar($Context, 'testvar', $value); print 'set db var to "' . $value . '": '; var_dump($return); $return = $IPP->getDBVar($Context, 'testvar'); print 'get db var: '; var_dump($return); print 'ERROR: ' . $IPP->errorCode() . ': ' . $IPP->errorText(); //exit; $info = $IPP->getDBInfo($Context); print_r($info);
<?php header('Content-Type: text/plain'); ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/Users/kpalmer/Projects/QuickBooks/'); require_once '../QuickBooks.php'; // $username = '******'; $password = ''; $token = ''; $realmID = 192848234; // $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application($Context, 'bf4in6uym'); $Service = new QuickBooks_IPP_Service_UOM(); $list = $Service->findAll($Context, $realmID); //print_r($list); foreach ($list as $UOM) { print 'Unit of measure [' . $UOM->getName() . '] of type [' . $UOM->getBaseType() . ']' . "\n"; for ($i = 0; $i < $UOM->countConvUnit(); $i++) { $ConvUnit = $UOM->getConvUnit($i); print "\t" . $ConvUnit->getName() . ', ' . $ConvUnit->getConvRatio() . "\n"; } print "\n"; }
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); require_once '../QuickBooks.php'; // $username = '******'; $password = '******'; $token = 'tex3r7hwifx6cci3zk43ibmnd'; $realmID = 173642438; $IPP = new QuickBooks_IPP(); $Context = $IPP->authenticate($username, $password, $token); $IPP->application('be9mh7qd5'); $name = 'my new name ' . mt_rand(); if ($IPP->renameApp($Context, $name)) { print 'Renamed the app! '; } else { print 'Rename failed: ' . $IPP->errorNumber() . ': ' . $IPP->errorMessage(); } print "\n\n"; print $IPP->lastRequest(); print "\n\n"; print $IPP->lastResponse(); print "\n\n";