Saturday, 29 December 2012

POST using Curl , Python and Lynx



Assume that you have a form , in the source look for something similar to :
input name="rid"  type="TEXT"
input name="submit" value="SUBMIT" type="SUBMIT" align="center"
Then , based on your needs select any of the methods to POST the data to the form and get the required results back
Using curl :
curl -s -d "rid=value%&submit=SUBMIT" <URL> > out.html

Using Python :
#!/usr/bin/env python
import urllib
# URL to post to
url = 'URL'
values = {'rid':    rid, 
            'submit': 'SUBMIT'}
html = urllib.urlopen(url, urllib.urlencode(values)).read()
print html

Using Lynx to dump data :
 curl -sd 'rid=1ap05cs013&submit=SUBMIT' <URL> | lynx -dump -nolist -stdin > out.html

No comments:

Post a Comment