Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    simulating a submit button

    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?


  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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.

  • #3
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but what about this last field,is it a cookie?

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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.
    Last edited by Rowsdower!; 10-17-2012 at 01:23 PM.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #5
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

    PHP Code:
    $curl_connection =curl_init('here is the site where i want this script to process');
            
    curl_setopt($curl_connectionCURLOPT_CONNECTTIMEOUT30);
            
    curl_setopt($curl_connectionCURLOPT_USERAGENT,
            
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
            
    curl_setopt($curl_connectionCURLOPT_RETURNTRANSFERtrue);
            
    curl_setopt($curl_connectionCURLOPT_SSL_VERIFYPEERfalse);
            
    curl_setopt($curl_connectionCURLOPT_FOLLOWLOCATION1);
          
            
            
    $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_connectionCURLOPT_POSTFIELDS$post_string);
            
    $result curl_exec($curl_connection);
            
    print_r(curl_getinfo($curl_connection));
            
    curl_close($curl_connection); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •