Fedora Linux Support Community & Resources Center
  #1  
Old 3rd March 2011, 02:21 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
windows_7chrome
Thumbs up Auto form completion.

I am working on a database project where I start with a .csv downloaded from the internet. In order to download the .csv one must fill out three web forms one after another before a download link is finally presented. I have been charged with automating the process of downloading this file. Is there a way that this can be done? I am looking for some insight.

Thanks!
Reply With Quote
  #2  
Old 3rd March 2011, 11:01 AM
giulix's Avatar
giulix Offline
"Fixed" by (vague) request
 
Join Date: Oct 2005
Location: GMT+ 1
Posts: 2,950
linuxfedorafirefox
Re: Auto form completion.

Sometime ago we were using Selenium to automate testing of web apps. It's useful to load large amounts of data in web pages
Reply With Quote
  #3  
Old 5th April 2011, 05:15 AM
Vector's Avatar
Vector Offline
Banned
 
Join Date: Jul 2006
Location: Transgression
Age: 33
Posts: 1,183
linuxfirefox
Re: Auto form completion.

Why don't you just WRITE something to do that? Eg, a site spammer/form poster. It's relatively quick and easy, in php.
Reply With Quote
  #4  
Old 5th April 2011, 05:50 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
windows_7chrome
Re: Auto form completion.

If I had an example I might be able to do that. Do you know where I can find some existing code?
Reply With Quote
  #5  
Old 5th April 2011, 05:56 AM
Vector's Avatar
Vector Offline
Banned
 
Join Date: Jul 2006
Location: Transgression
Age: 33
Posts: 1,183
linuxfirefox
Re: Auto form completion.

Sure, i do :

Code:
<?
$txt = '&subject=This+is+my+subject&message=I+wanted+to+take+a+moment+to+talk+to+you+about+viagra&action=post&submit=1&button.x=50&button.y=6';
$cookie = 'username=xxx; session=yyy';
$url = 'http://www.xxx.com/messages.php';
$i = 1;

while ($i < 804){
	$url = 'http://www.xxx.com/members.php?page='.$i;
	$html = file_get_contents($url);
	preg_match_all('/\/members\/profile\.php\?name\=([a-zA-Z0-9\-\_]+)/',$html,$matches);
	$i++;
	$matches = $matches[1];
	$matches = array_unique($matches);

	$f = fopen('/home/vector/Desktop/users.txt', 'a');
	foreach((array)$matches as $match){
		fwrite($f, $match."\n");
	}
	fclose($f);

	echo count($matches),"\n";
}

$matches = explode("\n",file_get_contents('/home/vector/Desktop/users.txt'));
//echo $matches;
//print_r($matches);

$i = 0;
foreach((array)$matches as $match){
	echo "\n\n\nSending to user {$i} ({$match})\n\n\n";
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:9050');
	curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);
	curl_setopt($ch, CURLOPT_COOKIE, $cookie);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Windows Internet Explorer 9.5.43');
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$match.$txt);
	$r = curl_exec($ch);
	//echo $r;
	exec("sleep 1");
	$i++;
}
Don't ask, don't tell

Last edited by Vector; 5th April 2011 at 05:59 AM.
Reply With Quote
Reply

Tags
auto, completion, form

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
emacs c++ auto code completion cola Programming & Packaging 0 25th May 2009 10:40 AM
emacs c++ tab completion daviddoria Using Fedora 1 16th June 2008 12:20 AM
A joke that needs completion... iwasapenguin Wibble 10 1st April 2007 04:38 PM
Yum and zsh completion scottmuz Using Fedora 3 4th November 2005 11:56 PM
How to install Fedora form ISO form harddisk? Stevenisme Installation and Live Media 3 5th March 2005 03:04 PM


Current GMT-time: 07:36 (Tuesday, 18-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat