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/

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

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀