Created
February 8, 2011 04:55
-
-
Save mimeoconnect/815881 to your computer and use it in GitHub Desktop.
This updates the status of an existing cloud print job using the Google Cloud Print (GCP) /control interface and the Zend PHP Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'Zend/Loader.php'; | |
Zend_Loader::loadClass('Zend_Http_Client'); | |
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); | |
// ID of the Print Job | |
$Job_ID = ""; | |
// Status of the Print Job | |
$Job_Status = ""; | |
// Gmail User Email | |
$G_Email = ""; | |
// Gmail User Password | |
$G_Pass = ""; | |
//Actually Register the Printer | |
$client = Zend_Gdata_ClientLogin::getHttpClient($G_Email, $G_Pass, 'cloudprint'); | |
// Get Token and Add Headers | |
$Client_Login_Token = $client->getClientLoginToken(); | |
$client->setHeaders('Authorization','GoogleLogin auth='.$Client_Login_Token); | |
$client->setHeaders('X-CloudPrint-Proxy','Mimeo'); | |
//GCP Services - Register | |
$client->setUri('http://www.google.com/cloudprint/interface/control'); | |
$client->setParameterPost('jobid', $Job_ID); | |
$client->setParameterPost('status', $Job_Status); | |
$response = $client->request(Zend_Http_Client::POST); | |
//echo $response; | |
$PrinterResponse = json_decode($response->getBody()); | |
//var_dump($PrinterResponse); | |
$Success = $PrinterResponse->success; | |
//echo "Success: " . $Success . "<br />"; | |
$Message = $PrinterResponse->message; | |
//echo "Message: " . $Message . "<br />"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment