understanding sending post request (with curl)

1

alright, I know related questions have been answered :

What is the cURL command-line syntax to do a POST request?

https://stackoverflow.com/questions/14978411/http-post-and-get-using-curl-in-linux

but my question is rather more basic,

Supposedly we have the following form in a html page:

<form action="/" method="post">
<h3>echo your name:</h3>
<input id="myname" name="myname" type="text" value="nafas">
<input type="image" src="/img/verifyName"  onclick="progress(true)">
<script type="text/javascript">document.write('<a href="#" onclick="document.getElementById(\'myname\').value=\'\';return false">Clear Field</'+'a>')</script>
</form>

Once botton is clicked , it basically echos what ever is typed in the text box

So my question is how exactly do the same thing with "curl". what do I need to echo my name?

server is running locally. I can't provide the link. but let's say its running at http://www.example.com

EDIT 1 :

this is how progress Function look like :

<script type="text/javascript">
function progress(s){var o=document.getElementById("myname");if(o){if(s){o.style.backgroundImage="url(/img/progress.gif)";o.style.backgroundPosition="right center";
o.style.backgroundRepeat="no-repeat";}else{o.style.backgroundImage="none";}}}
</script>

nafas

Posted 2015-03-24T12:50:00.067

Reputation: 409

Answers

2

In that form you provided, its Javascript that calls the function progress() and that function echoes the value.

There is no URL to send the value via post. Since it is handled via Javascript, whether curl nor wget can send the form for you.

chaos

Posted 2015-03-24T12:50:00.067

Reputation: 3 704

well there gotta be something that is sending that infromation. are you saying there is no way to mimic that behaviour? – nafas – 2015-03-24T13:33:48.987

Thats the clue: nothing is sended. Javascript just prints the value to you. No client server interaction has occured. – chaos – 2015-03-24T13:35:02.373

Oh I c, that means on the click, we don't send request to server as it is computed on local machine. – nafas – 2015-03-24T13:55:11.330

Exactly, javascript is executed in your browser. – chaos – 2015-03-24T13:56:25.013

right, apologies for my ignorance here. I disconnected computer from the internet, then clicked on the botton. I was expecting to get some results since there is no need of the host no more. by my surprise it is getting me "page not found" . so if I don't deal with the server no more, y does it care I need internet connection? – nafas – 2015-03-24T14:17:27.807

Then we have to know what exactly the progress() function does, you have to post that javascript part. Javascript can also request a new page. – chaos – 2015-03-24T14:19:23.453

just edited the question mate, I've added the progress(s) funcntion – nafas – 2015-03-24T14:22:32.650

It unfortunately changes nothing; no client server interaction, except the picture /img/progress.gif, the "page not found" error may come from that. – chaos – 2015-03-24T14:27:13.427

well thanks alot mate, u gave quite nice knowledge – nafas – 2015-03-24T14:38:19.150