2014-01-28 153 views
0

我试图使用一些代码到云打印与谷歌:包含Zend框架?

$client = Zend_Gdata_ClientLogin::getHttpClient('username', 'password', 'cloudprint'); 
     $Client_Login_Token = $client->getClientLoginToken(); 
     $client->setHeaders('Authorization','GoogleLogin auth='.$Client_Login_Token); 
     $client->setHeaders('X-CloudPrint-Proxy','Mimeo'); 

     $title = 'test'; 
     $fileUrl = 'url'; 
     $Printer_ID = 'ad83528c-a114-3f68-4768-c132ecc32ea2'; 


     $client->setUri('http://www.google.com/cloudprint/interface/submit'); 
     $client->setParameterPost('title', $title); 
     $client->setParameterPost('content', $fileUrl);  
     $client->setParameterPost('contentType', 'url'); 
     $client->setParameterPost('printerid', $Printer_ID); 
     $client->setParameterPost('capabilities', '{}'); 
     $client->setConfig(array('timeout' => 180));   
     $response = $client->request(Zend_Http_Client::POST); 
     $response = json_decode($response->getBody()); 
     var_dump($response); 

我得到这个错误:

Fatal error: Class 'Zend_Gdata_ClientLogin' 

我使用GoDaddy的共享主机。是否只有一个文件,我可以include_once将包含此。我已经下载了Zend框架但找不到该类?

+0

你的Bootstrap整个Zend的应用程序,或者你只是想使用Zend框架的一部分?你有没有下载最新版本的Zend Framework 1? – s7anley

+0

我只需要这一部分。我下载了Zend 2.那是为什么我找不到它?! –

+1

是的,它在[Zend Framework 1]中(https://github.com/zendframework/zf1/tree/master/library/Zend/Gdata)。检查[文档](http://framework.zend.com/manual/1.12/en/zend.gdata.introduction.html)。 – s7anley

回答

1

下载Zend Framework,把它放到你的服务器上的一个目录中,把这个目录添加到你的包含路径中。

<?php 
$path = '/usr/lib/zend'; 
set_include_path(get_include_path() . PATH_SEPARATOR . $path); 
?> 
+0

我应该有ZendFramework-2.2.5吗? –

+1

看起来像你使用的是1.x版本。 Zend有几种依赖关系。您可能需要使用多个包 – user1168095