Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

learn unix and linux commands

How to submit form on an php webpage from command line?

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-06-2014
postcd postcd is offline
Banned
 
Join Date: Oct 2013
Last Activity: 11 August 2016, 12:58 PM EDT
Posts: 87
Thanks: 14
Thanked 2 Times in 2 Posts
Power How to submit form on an php webpage from command line?

Hello,

i have page domain.com/form.php

the form fields on form.php are named:


Code:
name=ipaddress
name=port

and submit button is named: submit

i want to ask how the linux command will look like to submit the form filled with:

ipaddress: 127.0.0.1
port: 80

I tried various curl and wget commands but no luck to get page and submit
Sponsored Links
    #2  
Old Unix and Linux 02-06-2014
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 19 June 2017, 5:37 PM EDT
Location: Saskatchewan
Posts: 22,244
Thanks: 1,101
Thanked 4,193 Times in 3,880 Posts

Code:
wget --post-data="field1=value1&field2=value2" site

Please show what 'various things' you try and exactly in what way they 'do not work'.
Sponsored Links
    #3  
Old Unix and Linux 02-07-2014
postcd postcd is offline
Banned
 
Join Date: Oct 2013
Last Activity: 11 August 2016, 12:58 PM EDT
Posts: 87
Thanks: 14
Thanked 2 Times in 2 Posts
Quote:
Originally Posted by Corona688 View Post
Code:
wget --post-data="field1=value1&field2=value2" site

I tried this and it appears it just downloading data to my computer instead submitting webform, im not sure Linux
    #4  
Old Unix and Linux 02-07-2014
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 19 June 2017, 5:37 PM EDT
Location: Saskatchewan
Posts: 22,244
Thanks: 1,101
Thanked 4,193 Times in 3,880 Posts
All web page queries end up downloading something. That also uploads a POST query too, namely, "field1=value1&field2=value2".

You did change this to your needs, yes?

You did check your server for the necessary results, yes?

If not, both of those things would be a real great idea.
Sponsored Links
    #5  
Old Unix and Linux 02-07-2014
postcd postcd is offline
Banned
 
Join Date: Oct 2013
Last Activity: 11 August 2016, 12:58 PM EDT
Posts: 87
Thanks: 14
Thanked 2 Times in 2 Posts
Quote:
Originally Posted by Corona688 View Post
All web page queries end up downloading something. That also uploads a POST query too, namely, "field1=value1&field2=value2".

You did change this to your needs, yes?

You did check your server for the necessary results, yes?

Yes, i changed it to match my form field names and the file it downloaded is just php file with html content (source code) i dont know how more i can check results.

i found that in the form is another field like:
<input type="hidden" name="hobby" value="football">

but i did not mention this field in my command, not sure if its correct
Sponsored Links
    #6  
Old Unix and Linux 02-07-2014
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 19 June 2017, 5:37 PM EDT
Location: Saskatchewan
Posts: 22,244
Thanks: 1,101
Thanked 4,193 Times in 3,880 Posts
Yes, you need to mention that value, too.

If you don't know then I certainly don't. Sorry. All I can tell you is that it's going to download a .php file whether the form succeeds or not... Its contents might tell you whether it succeeded or failed. What is supposed to happen when you submit this form?

Last edited by Corona688; 02-07-2014 at 11:28 AM..
Sponsored Links
 


Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to read command line input and change it to some form Raza Ali Shell Programming and Scripting 2 07-22-2013 11:44 AM
Can't submit a form. tip78 Shell Programming and Scripting 28 02-13-2013 01:08 PM
Using cURL to submit a post form hansvg Shell Programming and Scripting 2 07-24-2012 02:50 PM
using wget to submit a form on linksys router mike909 Shell Programming and Scripting 1 04-11-2009 03:32 PM
PHP Help with Form Submit nck Shell Programming and Scripting 3 03-26-2009 11:14 AM



All times are GMT -4. The time now is 04:37 AM.