cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to use curl to manipulate the web message?

From: Alfred Zhang <alfredzhang83_at_gmail.com>
Date: Wed, 27 Jun 2012 15:41:04 +0800

 From: Weedy <weedy2887_at_gmail.com<weedy2887_at_gmail.com?Subject=Re:%20How%20to%20use%20curl%20to%20manipulate%20the%20web%20message?>>

Date: Wed, 27 Jun 2012 00:55:30 -0400

On 26/06/12 09:55 PM, Alfred Zhang wrote:
*> Dear friends, *
*> *
*> Good morning my frends, I am a fresh men for using curl , and I am very *
*> glad to join curl-user mailing list. *
*> I have a problem on how to post a form with "curl -d" , e.g. , asuming *
*> I want to use Google to search a *
*> key word "cat" , how can I use curl to make it? *

If all you want to do is get search results you only need URL encode the
"q" parameter. That said doing anything automated with google probably
violated there TOS
https://www.google.ca/search?q=cat&hl=en&num=10&lr=lang_en

Dear Weedy ,

Thanks for your great help, this method is very useful to me .
Acturely , my question is from this articule :

   http://curl.haxx.se/docs/httpscripting.html
In this articule , the section 4.2 said :
......

* The form would look very similar to the previous one:

        <form method="POST" action="junk.cgi">
          <input type=text name="birthyear">
          <input type=submit name=press value=" OK ">
        </form>

  And to use curl to post this form with the same data filled in as before, we
  could do it like:

        curl --data "birthyear=1905&press=%20OK%20"
http://www.example.com/when.cgi
......
*

So, I think that if the html element "*<input type=submit name=press
value=" OK ">* " does not contain an "*name*" attribute, like

*<input type=submit value=" OK ">
*thus, what should the curl command be ? Maybe like the following command ?

*curl --data "birthyear=1905" http://www.example.com/when.cgi*

Dose this right?

*Best Reguards to you !
Have a nice day !*

-- 
我以为看到了曙光。。。。。。

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-27