[英]How to send files via post request in python similar to curl? (W3C validator)
[英]trying to POST to w3c validator with python script
我正在嘗試使用此 python腳本將文件上傳到w3c驗證程序 。
~/Desktop/urllib2_file$ python test-upload.py -u http://validator.w3.org/ -f ../index.php -n uploaded_file -p Content-Type=text/html > ../results.html && firefox ../results.html
任何幫助將不勝感激!
編輯:
cyraxjoe指出我需要首先通過php運行它。 我嘗試了這個,但是得到了相同的結果:
php -f /opt/lampp/htdocs/index.php > index.html && python urllib2_file/test-upload.py -u http://validator.w3.org/ -f index.html -n uploaded_file -p Content-Type=text/html > results.html && firefox results.html
您要上傳的是服務器端腳本php-script,需要在php處理后上傳生成的html。 也許使用php-cli然后將結果文本存儲在文件中並上傳該文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.