English 中文(简体)
筛选报废——但可以模拟 j
原标题:Screen scraping - But can t simulate javascript
  • 时间:2012-04-09 12:17:47
  •  标签:
  • asp.net

我没有问题要下载一部特定的URL。

但我有一个伙伴关系。 互联网第一页必须检查报废数据,而有趣的数据则落在一个纽扣的后面。 我怎么能够模拟对该纽特的点击,并获取网络服务器将产生的数据?

纽瓦特人手法如下:

javascript:__doPostBack( ctl00$ctl01$DefaultSiteContentPlaceHolder1$Col1$ucNavBar$rptButtons$ctl00$btnPage ,  )

现在我正在利用这一伙伴关系。 获取特定URL内容的网络代码:

public string GetDataFromUrl(string strUrl) 
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(strUrl);
 request.Accept = "text/html, application/xhtml+xml, */*";  
request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;      Trident/5.0)";
 request.KeepAlive = true;
 using (StreamReader streamReader = new          StreamReader(request.GetResponse().GetResponseStream(), Encoding.UTF8, true))
 {
 return streamReader.ReadToEnd();
 }
}

页: 1

I have found a solution. Used the program Fiddler to be able to see exactly what happens when I clicked on the button. Then I tried to make a POST that looked so simular as the real call as possible.

最佳回答

参看_doPostBack功能中的代码,并照搬该代码。

采用人工操作方式并不困难。 混合 Java字发动机,使其能够处理任何类型的文字,是一个完全不同的问题。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签