douyong1885 2010-11-27 14:16
浏览 51

Zend Framework中httpClient中的cookie问题

I create the httpClient in Zend framework to make page requests. I am trying to add a cookie but it does not seem to work according to the data which I get. Can you please tell me what am I doing wrong?

$httpClient = new HttpClient();
$httpClient->setConfig 
(array(
    'timeout'     => 30, 
    'useragent'   => "Opera/9.80 (Windows NT 5.1; U; ru)Version/10.62",
    'adapter'     => 'Zend_Http_Client_Adapter_Curl', 
    'curloptions' => array 
    (
        CURLOPT_TIMEOUT          => 30,
        CURLOPT_FRESH_CONNECT    => true,
    ),
));


$httpClient->setCookieJar();

$cookie = Zend_Http_Cookie::fromString('abc=1000; ' +
                                       'domain=.abc.ru; ' +
                                       'path=/; ' +
                                       'expires=Wednesday, 28-Feb-12 20:41:22 UTC');
$httpClient->setCookie($cookie);
  • 写回答

1条回答 默认 最新

  • doujing5435 2011-01-12 09:39
    关注

    You cannot join strings with plus sign in PHP:

    'abc=1000; ' +
    'domain=.abc.ru; ' +
    'path=/; ' +
    'expires=Wednesday, 28-Feb-12 20:41:22 UTC'
    

    Plus sign is arithmetic operator and this statement simply results in '0'. Use '.' operator.

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler