douqie1852 2013-05-13 09:52
浏览 46
已采纳

如何以正确的方式使用zend_http_client或curl

I'm using zend_http_client. What i want is to send a request to transfer(without redirecting) to another site and send number in field that I have and get the answer with info i need to use on my site. That's what i'm doing, but how to send my number to that field and submit it?

 $url = 'http://gdeposylka.ru/';
                        $config = array(
                            'timeout' => 30
                        );
                        $client = new Zend_Http_Client($url, $config);
                        try {
                            $response = $client->request('GET');
                            if ($response->getStatus() == 200) {
                                $ctype = $response->getHeader('Content-type');
                                $body = $response->getBody();
                                $dom = new Zend_Dom_Query($body);
                                $results = $dom->query('limit');
                                $item->site_k = 1 + (int) $results->current()->textContent;
                                var_dump($response);
                                exit;
                            }
                        } catch (Zend_Http_Client_Adapter_Exception $e) {

                        }

Thanks and sorry for grammar mistakes.

  • 写回答

1条回答 默认 最新

  • doulao2128 2013-05-13 10:33
    关注

    Because there is a hash on the site you're trying to send a request, you probably wont be able to get this done. Hash mechanism makes it impossible to send request straight to the URL stated in action param of form tag. It's designed particulary to prevent such action you want to make. Still, since there is no captcha you can try web automation.

    What you might find useful is ie. Selenium http://docs.seleniumhq.org/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能