-
Notifications
You must be signed in to change notification settings - Fork 16
/
gcp-fetch.php
47 lines (32 loc) · 1007 Bytes
/
gcp-fetch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
// ID of the Printer
$Printer_ID = "";
// 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/fetch');
$client->setParameterPost('printerid', $Printer_ID);
$JobResponse = json_decode($response->getBody());
$Success = $JobResponse->success;
if(isset($JobResponse->jobs))
{
$Jobs = $JobResponse->jobs;
foreach($Jobs as $Job)
{
$Job_ID = $Job->id;
$Job_Title = $Job->title;
$File_URL = $Job->fileUrl;
}
}
?>