Auto fill and submit forms on external site

前端 未结 1 1465
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 05:55

I was wondering how does one auto fill multiple forms (using bot/local server) on multiple pages of external site (PHP) using ajax or curl.

For example

相关标签:
1条回答
  • 2021-01-01 06:29

    The easiest way is to using something like greasemonkey ( https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ ), but the better solution is to use the firebug 'net' tab to capture the post sent when you fill out the form and repeat that post with CURL ( http://php.net/manual/en/book.curl.php )

    function post($url,$data) { 
        $process = curl_init($url); 
        curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); 
        curl_setopt($process, CURLOPT_HEADER, 1); 
        curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); 
        if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file); 
        if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file); 
        curl_setopt($process, CURLOPT_ENCODING , $this->compression); 
        curl_setopt($process, CURLOPT_TIMEOUT, 30); 
        if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); 
        curl_setopt($process, CURLOPT_POSTFIELDS, $data); 
        curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); 
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); 
        curl_setopt($process, CURLOPT_POST, 1); 
        $return = curl_exec($process); 
        curl_close($process); 
        return $return; 
    } 
    
    0 讨论(0)
提交回复
热议问题