如何使用Zend_Rest_Client处理cookie?

时间:2011-12-22 22:43:25

标签: php curl zend-framework

我一直在使用Curl进行网络通话,我可以使用COOKIEJAR选项为我的请求使用Cookie。

最近我开始使用Zend_REST_Client,我不确定,怎么做?有人能说明这是最好的方法吗?

1 个答案:

答案 0 :(得分:1)

Zend_Http_Client可以使用Zend_Http_CookieJar处理cookie jar。我认为Zend_REST_Client依赖于Zend_Http_Client,所以你应该能够使用cookie jar。

$client = new Zend_Http_Client();
$cookieJar = new Zend_Http_CookieJar();
$client->setCookieJar($cookieJar);
Zend_Rest_Client::setHttpClient($httpClient);