<bdo id='5ZZcC'></bdo><ul id='5ZZcC'></ul>

    <small id='5ZZcC'></small><noframes id='5ZZcC'>

    1. <i id='5ZZcC'><tr id='5ZZcC'><dt id='5ZZcC'><q id='5ZZcC'><span id='5ZZcC'><b id='5ZZcC'><form id='5ZZcC'><ins id='5ZZcC'></ins><ul id='5ZZcC'></ul><sub id='5ZZcC'></sub></form><legend id='5ZZcC'></legend><bdo id='5ZZcC'><pre id='5ZZcC'><center id='5ZZcC'></center></pre></bdo></b><th id='5ZZcC'></th></span></q></dt></tr></i><div id='5ZZcC'><tfoot id='5ZZcC'></tfoot><dl id='5ZZcC'><fieldset id='5ZZcC'></fieldset></dl></div>

      <tfoot id='5ZZcC'></tfoot>
    2. <legend id='5ZZcC'><style id='5ZZcC'><dir id='5ZZcC'><q id='5ZZcC'></q></dir></style></legend>

      是否有相当于 Perl 的 WWW::Mechanize 的 PHP?

      Is there a PHP equivalent of Perl#39;s WWW::Mechanize?(是否有相当于 Perl 的 WWW::Mechanize 的 PHP?)

          <tbody id='GHcCd'></tbody>
      1. <tfoot id='GHcCd'></tfoot>
          <bdo id='GHcCd'></bdo><ul id='GHcCd'></ul>
          <i id='GHcCd'><tr id='GHcCd'><dt id='GHcCd'><q id='GHcCd'><span id='GHcCd'><b id='GHcCd'><form id='GHcCd'><ins id='GHcCd'></ins><ul id='GHcCd'></ul><sub id='GHcCd'></sub></form><legend id='GHcCd'></legend><bdo id='GHcCd'><pre id='GHcCd'><center id='GHcCd'></center></pre></bdo></b><th id='GHcCd'></th></span></q></dt></tr></i><div id='GHcCd'><tfoot id='GHcCd'></tfoot><dl id='GHcCd'><fieldset id='GHcCd'></fieldset></dl></div>

              <legend id='GHcCd'><style id='GHcCd'><dir id='GHcCd'><q id='GHcCd'></q></dir></style></legend>

                <small id='GHcCd'></small><noframes id='GHcCd'>

                本文介绍了是否有相当于 Perl 的 WWW::Mechanize 的 PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在寻找一个功能类似于 Perl 的WWW::Mechanize,但适用于 PHP.基本上,它应该允许我使用简单的语法提交 HTTP GET 和 POST 请求,然后解析结果页面并以简单格式返回所有表单及其字段以及页面上的所有链接.

                I'm looking for a library that has functionality similar to Perl's WWW::Mechanize, but for PHP. Basically, it should allow me to submit HTTP GET and POST requests with a simple syntax, and then parse the resulting page and return in a simple format all forms and their fields, along with all links on the page.

                我知道 CURL,但它有点过于准系统,而且语法非常难看(大量的 curl_foo($curl_handle, ...) 语句

                I know about CURL, but it's a little too barebones, and the syntax is pretty ugly (tons of curl_foo($curl_handle, ...) statements

                说明:

                我想要比目前的答案更高级的东西.例如,在 Perl 中,您可以执行以下操作:

                I want something more high-level than the answers so far. For example, in Perl, you could do something like:

                # navigate to the main page
                $mech->get( 'http://www.somesite.com/' ); 
                
                # follow a link that contains the text 'download this'
                $mech->follow_link( text_regex => qr/download this/i );
                
                # submit a POST form, to log into the site
                $mech->submit_form(
                    with_fields      => {
                        username    => 'mungo',
                        password    => 'lost-and-alone',
                    }
                );
                
                # save the results as a file
                $mech->save_content('somefile.zip');
                

                要使用 HTTP_Client 或 wget 或 CURL 做同样的事情将需要大量工作,我必须手动解析页面以查找链接、查找表单 URL、提取所有隐藏字段等.我要求 PHP 解决方案的原因是我没有使用 Perl 的经验,我可能可以通过大量工作来构建我需要的东西,但如果我能在 PHP 中完成上述操作,速度会快得多.

                To do the same thing using HTTP_Client or wget or CURL would be a lot of work, I'd have to manually parse the pages to find the links, find the form URL, extract all the hidden fields, and so on. The reason I'm asking for a PHP solution is that I have no experience with Perl, and I could probably build what I need with a lot of work, but it would be much quicker if I could do the above in PHP.

                推荐答案

                SimpleTest 的 ScriptableBrowser 可以独立于测试框架使用.我已经将它用于许多自动化工作.

                SimpleTest's ScriptableBrowser can be used independendly from the testing framework. I've used it for numerous automation-jobs.

                这篇关于是否有相当于 Perl 的 WWW::Mechanize 的 PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tbody id='J8NSY'></tbody>

                  <bdo id='J8NSY'></bdo><ul id='J8NSY'></ul>
                • <i id='J8NSY'><tr id='J8NSY'><dt id='J8NSY'><q id='J8NSY'><span id='J8NSY'><b id='J8NSY'><form id='J8NSY'><ins id='J8NSY'></ins><ul id='J8NSY'></ul><sub id='J8NSY'></sub></form><legend id='J8NSY'></legend><bdo id='J8NSY'><pre id='J8NSY'><center id='J8NSY'></center></pre></bdo></b><th id='J8NSY'></th></span></q></dt></tr></i><div id='J8NSY'><tfoot id='J8NSY'></tfoot><dl id='J8NSY'><fieldset id='J8NSY'></fieldset></dl></div>
                    <tfoot id='J8NSY'></tfoot><legend id='J8NSY'><style id='J8NSY'><dir id='J8NSY'><q id='J8NSY'></q></dir></style></legend>

                      <small id='J8NSY'></small><noframes id='J8NSY'>