HTTP Post

I’m trying to develop a plugin for a certain website. I want to get some videos from it but it needs to submit a form with the POST method.

What is the best way to send this form and get the returned content as an XML object (or something I can use xpath on)?



Hope anyone can help me.



Thanks

Hi jaaps!

Using POST is not very different from a “normal” GET. The difference is in the values parameter. Here is a simple example that does a POST request with a username and password:



post_values = {<br />
  'username' : 'sander1',<br />
  'password' : 'terces'<br />
}<br />
<br />
content = XML.ElementFromURL('http://www.website.com', isHTML=True, values=post_values)


Now you can do xpath queries on *content*.

Thanks, works perfectly!



Now I have another question: How do I clear cookies set by a website?

Great question, I’m not sure if that’s supported, I will ask Jam about it!

There is an HTTP.ClearCookies() added in the next version of the Framework, so that should meet your needs.