使用PowerShell Invoke-WebRequest从webform下载PDF文件

时间:2014-03-01 03:01:34

标签: powershell

我想通过PowerShell填写Web表单和HTTP Post,它应该提供PDF输出文件。任何帮助都会有所帮助!!

这是我部分尝试的方式:

Invoke-WebRequest Uri "http://ldsjljfs/fsjlj/areport.asp?chill=10&reportuser=me&reportuserpw=you&ReportName=hello%5there+%2Dfdsfsfs" -Method Post -Outfile test.pdf -Body ?

如何发送参数并确保在提交时,pdf将被存储?

请帮忙! Web表单的源代码看起来像

<html>
<head>
<script language=Javascript>
function UpdateText(NewText,TextBox)
</script>
<SCRIPT LANGUAGE="JavaScript" SRC="AnchorPosition.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="date.js"></SCRIPT> 
<SCRIPT LANGUAGE="JavaScript" SRC="PopupWindow.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" ID="js1">
 var cal1 = new CalendarPopup();
</SCRIPT>
</head>
<body>
<h4>A Report</h4>
<form name=ParamForm action='areport.asp' method=POST>
Select values for the following parameter(s):<br><br><table border=1 cellspacing=0>
<tr><td Bgcolor=#FFFFFF >
<b>Start Date</b></td><td Bgcolor=#FFFFFF >
<input type='text' name='Text0' size='20' value='5/20/2013'>
<A HREF="#" onClick="cal1.select(document.forms['ParamForm'].Text0,'anchor0','MM/dd/yyyy'); return false;"       TITLE="cal1.select(document.forms[0].Text0,'anchor0','MM/dd/yyyy'); return false;" NAME="anchor0"   ID="anchor0">Select Date</A><BR>
<tr><td Bgcolor=#D4D0C8 >
<b>End Date</b></td><td Bgcolor=#D4D0C8 >
<input type='text' name='Text1' size='20' value='6/30/2013'>
<A HREF="#" onClick="cal1.select(document.forms['ParamForm'].Text1,'anchor1','MM/dd/yyyy'); return false;"    TITLE="cal1.select(document.forms[0].Text1,'anchor1','MM/dd/yyyy'); return false;" NAME="anchor1" ID="anchor1">Select Date</A><BR>
<tr><td Bgcolor=#FFFFFF >
<b>Color</b><br>    Required</td><td Bgcolor=#FFFFFF >
<input type='text' name='Text2' size='20' value='ST'>
`<select Size=1Name='Drop2'onchange="UpdateText(document.ParamForm.Drop2.options[document.ParamForm.Drop2.selectedIndex ].text,document.ParamForm.Text2)">`
<option></option>
<option>Blue</option>
<option>Yellow</option>
<option>Green</option>
</select>
<tr><td Bgcolor=#D4D0C8 >
<b>Code</b><br>
fixed (01)</td><td Bgcolor=#D4D0C8 >
<input type='text' name='Text3' size='20' value='01'>
<tr><td Bgcolor=#FFFFFF ><!-- % 
 Response.Write "Sort By:<BR>"
 Response.Write "<select size=1 name='FieldsToSortOn'>"
 Response.Write(PrintSortingOptions(databaseFields, clientDoc))
 Response.Write "</select>"
 % -->
 <b>Status</b><br>
 (leave BLANK for ALL)</td><td Bgcolor=#FFFFFF >
 <input type='Hidden' name='Text4' size='20' value=''>
 <select Size=1   Name='Drop4'onchange="UpdateText(document.ParamForm.Drop4.options[document.ParamForm.Drop4.selectedIndex ].text,document.ParamForm.Text4)">
 <option></option>
 <option>ACTIVE</option>
 <option>CLOSED</option>
 <option>PENDING</option>
 </select>
 <tr><td Bgcolor=#D4D0C8 >
  <b>Type</b><br>
  </td><td Bgcolor=#D4D0C8 >
 <input type='text' name='Text5' size='20' value='A'>
 <tr><td Bgcolor=#FFFFFF >
 <b>Gate</b><br>
 </td><td Bgcolor=#FFFFFF >
 <input type='text' name='Text6' size='20' value='7'>
 </table><br>
 <input type='submit' class='button' value='Run Report' name='cmdSaveParameters' runat='server'><br><br>
 <hr>
</body>
</html>

0 个答案:

没有答案