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>
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.

  • well there gotta be something that is sending that infromation. are you saying there is no way to mimic that behaviour? – nafas Mar 24 '15 at 13:33
  • Thats the clue: nothing is sended. Javascript just prints the value to you. No client server interaction has occured. – chaos Mar 24 '15 at 13:35
  • Oh I c, that means on the click, we don't send request to server as it is computed on local machine. – nafas Mar 24 '15 at 13:55
  • Exactly, javascript is executed in your browser. – chaos Mar 24 '15 at 13:56
  • 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 Mar 24 '15 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.