2
我需要使用Linux命令行发布表单和上传文件到网站。使用Linux命令行发布表单和上传文件
我已经做了一些搜索,我想用Python编写脚本。
我需要先登录网站,保存cookie,然后发布表单数据并上传文件到该网站。
以下是详细信息:
该网站的登录页面是:hxxp://www.example.com/login.html
<form action="/signin.html" method="post">
Username:<input type="text" name="username">
Password:<input type="password" name="password">
<input type="hidden" name="referer" value="http://www.example.com/">
<input type="submit" name="submit" value=" Login ">
</form>
上传页面是:hxxp://www.example.com.com/upload/
<form action="http://www.example.com:81/upload/upload.cgi" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="314572800" />
File:
<input name="filename[]" type="file" />
Type:
<input type="radio" name="typeID" value=1> Option One
<input type="radio" name="typeID" value=2> Option Two
<input type="radio" name="typeID" value=3> Option Three
Title:
<input type="text" name="title" >
Description:
<textarea name="description"></textarea>
<input type="checkbox" name="agree" value="agree_terms"> I Accept Terms
<input type="submit" value="Upload It!">
</form>
此表单包含广播,文本,复选框,文件等输入。
请给我一些提示!
我正在使用CentOS 5.5,使用Python,wget,PHP安装。我认为这可以在Python脚本中完成。
非常感谢!您的答案将是我收到的最好的圣诞礼物。 ;)