最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net - How do I get url that is hidden by javascript on external website? - Stack Overflow

programmeradmin0浏览0评论

How do I get url that is hidden by javascript on external website?

ex: .aspx This url is constant through navigation of pages, so page content is loaded by javascript.

link location of a page:

javascript:__doPostBack('ctl00$masterContent$DataPager2$ctl00$ctl00','')
javascript:__doPostBack('ctl00$masterContent$DataPager1$ctl00$ctl01','')
javascript:__doPostBack('ctl00$masterContent$DataPager1$ctl00$ctl02','')

.....

Is there a way to analyze (manually or by PHP script) the function __doPostBack to find out about the urls?

Thx in advance

How do I get url that is hidden by javascript on external website?

ex: http://royaldesign.se/Att_Dricka.aspx This url is constant through navigation of pages, so page content is loaded by javascript.

link location of a page:

javascript:__doPostBack('ctl00$masterContent$DataPager2$ctl00$ctl00','')
javascript:__doPostBack('ctl00$masterContent$DataPager1$ctl00$ctl01','')
javascript:__doPostBack('ctl00$masterContent$DataPager1$ctl00$ctl02','')

.....

Is there a way to analyze (manually or by PHP script) the function __doPostBack to find out about the urls?

Thx in advance

Share Improve this question edited Aug 20, 2012 at 23:57 Joe Doyle 6,3833 gold badges44 silver badges45 bronze badges asked Aug 20, 2012 at 23:48 Alex MassAlex Mass 11 gold badge1 silver badge1 bronze badge 3
  • What would you do with it if you had it? In your example, the javascript is doing a post back, which is a "link" to the original page. – Seth Commented Aug 20, 2012 at 23:51
  • You might be interested in my answer to another question just now: stackoverflow./questions/12029324/… – IMSoP Commented Aug 20, 2012 at 23:57
  • I need those urls in order to fetch the content of pages. I use file_get_contents from php. So the solution would be either get the urls or simulate the pagination using __doPostBack function. – Alex Mass Commented Aug 21, 2012 at 14:22
Add a ment  | 

3 Answers 3

Reset to default 0

Those values are not hidden, the __doPostBack method posts back to itself. Those values passed to doPostBack represent the html ID's of the control doing the postback.

The page your looking at is written in ASP.NET also, not PHP.

You can use your browsers debug tools to see what data is being passed back to the server via javascript.

The __doPostBack javascript function is used to submit data to an asp page.

The first parameter to the function is the event target. This is the ClientID of the control that is being clicked.

Asp uses this value to raise a Click event on the server when the page gets submitted.

You can call this __doPostBack function via javascript yourself to get the same behavior as a user clicking it.

I gave some tips on "scraping" ASP pages on this other question: curl script just filling up the form not submitting it

The basics of simulating a POST request using CURL are discussed here: PHP + curl, HTTP POST sample code?

I would also add that if the site you are "scraping" from is owned by someone you are on friendly terms with (and not e.g. a petitor!) you may be able to save a lot of time by asking nicely for the content, or a static URL that gives you the content.

发布评论

评论列表(0)

  1. 暂无评论