0

I have just started to look into Python.

Site: http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi

Is it possible for a bot to put data in the top box, maybe tick a box or something, and click the button at the bottom "convert"?

Oh and also, under the Options header, there is a box where you can choose various options. How exactly do you get the bot to choose one of them?

Thanks

3
  • 1
    Have you done any serious research first before asking? Commented Dec 22, 2012 at 11:16
  • When I first created this question, for some reason it was linking me to IRC bots. So that's not what I had in mind I have searched google, but I wasn't sure what exactly to search for. "How to make a bot input data onto a website"?, "Make a bot access a web page"?. But yes, I have looked. Is there any module I could use/documentation I can read? Commented Dec 22, 2012 at 11:19
  • See stackoverflow.com/questions/7047790/…, maybe Commented Dec 22, 2012 at 11:23

1 Answer 1

1

Of course you can but you will not input HTML code with your bot. If you look at the source code for the page you will see:

<form method="post" action="index.cgi">
<fieldset style="display:none">
  <input type="hidden" name="m" value="convert" />
</fieldset> 
...

It does say that the form uses the method post to this uri: http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi

So now you can look at urllib2, urllib2 which is the python lib for http requests. And create your post request with the parameter you want.

E.g:

params = {
  'dialect' : googlecode,
  'uri' : myuri
}

You will need a header, telling the server who is doing the request:

E.g:

headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}

Something like this:

u = urllib2.urlopen(' http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi', params)
h.request('POST', ' http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi', params, headers)
Sign up to request clarification or add additional context in comments.

4 Comments

I'm not exactly sure I understand your response. Sorry.
TO be more specific, your second line. What do you mean by "headers"?
I suggest you learn about http: jmarshall.com/easy/http because this is quite easy when you know it.
and uri, what is that. I'm such a newb :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.