Need a script that check check boxes then click the cubmit button

Discussion in 'Programming' started by badrovichxx, Mar 26, 2011.

  1. #1
    Hi there,

    i need a script that open a txt file that will have a lot of urls one per line then open each url then automaticaly check the box and click a submit button and repeat this for all the urls on that file.

    tell me how much you want for this script?
     
    Last edited: Mar 26, 2011
    badrovichxx, Mar 26, 2011 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    
    
    $file = file_get_contents('file.txt');
    
    $site_list = explode(PHP_EOL, $file);
    
    $post_values = array('checkboxname' => 'checkboxvalue', 'otherfieldsnames' => 'otherfeildsvalues');
    
    foreach ($site_list as $siteURL)
    {
         $site_result = processWebsite($siteURL, $post_values);
         echo $site_result;
    }
    
    function processWebsite($url, $post_values)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST      ,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_values);
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); 
        curl_setopt($ch, CURLOPT_HEADER, 0); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
        $output = curl_exec($ch);
        curl_close($ch);
        return $output;
    }
    
    
    PHP:
    Assuming that the file has a URL at each line.
     
    ThePHPMaster, Mar 26, 2011 IP
  3. badrovichxx

    badrovichxx Peon

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much for your help and your courtesy :)
     
    badrovichxx, Mar 27, 2011 IP