...

View Full Version : simulating a submit button



shile
10-16-2012, 10:54 PM
i want to make a script that will simulate submit button function if a certain condition is satisfied,i researched a bit and i found that i need to do it with php's curl functions...i sniffed what submit button does and what fields it produces,here is a picture of the sniffed submit button...can you help me make a curl script?

http://s7.postimage.org/nn7mngqm3/fiddler.png

Fou-Lu
10-17-2012, 12:24 AM
All the submit button is, is an input with the name and value. You simply need to provide that name => value combination with a part of the form data in a curl.

shile
10-17-2012, 12:57 PM
but what about this last field,is it a cookie?

Rowsdower!
10-17-2012, 02:21 PM
I'm not familiar with the Joomla JXTC appointment book system but the last one looks like it's just a token (probably session-specific) that the page generates in order to validate the user to prevent people sending submit data to them "in the blind." You will probably have to visit their page once to get the token, and then again to submit the data.

Whether that particular variable comes from a cookie or not, I can't say (I have no idea how you generated your table of data) but your cURL can be set to use cookies if needed so you will eventually be good to go either way. You'll just have to feel it out.

shile
10-17-2012, 03:24 PM
i generated this table from fiddler,i sniffed what submit button did so i can make my curl script...this is my script that doesnt work...



$curl_connection =curl_init('here is the site where i want this script to process');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);


$post_data['appointment']='10:00:00';
$post_data['title']='titl';
$post_data['email']='email';
$post_data['field1']='field1';
$post_data['field2']='field2';
$post_data['option']='com_jxtcappbook';
$post_data['view']='book';
$post_data['task']='save';
$post_data['id']='0';
$post_data['cid[]']='0';
$post_data['ordering']='0';
$post_data['parent_id']='1';
$post_data['published']='1';

$post_data['date']='2012-10-29';
$post_data['duration']='01:00:00';
$post_data['start']='10:00:00';
$post_data['end']='11:00:00';
$post_data['pop']='0';

=>i have put put fields like this just for test<=

foreach($post_data as $key =>$value){
$post_items[]=$key.'='.$value;
}
$post_string=implode('&',$post_items);

curl_setopt($curl_connection,CURLOPT_POST,1);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($curl_connection);
print_r(curl_getinfo($curl_connection));
curl_close($curl_connection);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum