How to parse an html file to follow up a specific data?
My target web site is: http://www.imkb.gov.tr/H开发者_C百科ome.aspx
Please focus this on that page: "XU100 64.882,72 -1.36 %" it is on top..
The exact target is 64.882,72 this value!...
What is the best way for this value?
My platform: asp.net , c#
Well if you look at the source of the page, you will see that line looks like this:
<span id="ctl00_cphTicker_ctl00_lblUlusal100">XU100 64.882,72 </span>
Should not be hard to look for the constant ctl00_cphTicker_ctl00_lblUlusal100
and what comes after.
Looking a bit more at the page it is clear it is being updated by AJAX (a Telerik control). If you download fiddler 2 and take a look I'd bet be it would not be hard to figure out their API and get it straight from the source. Reading it from a page seems a little round about to me.
update
Here you go: Every 5 mins or so, page sends something like this:
POST http://www.imkb.gov.tr/Home.aspx HTTP/1.1 Host: www.imkb.gov.tr Connection: keep-alive Referer: http://www.imkb.gov.tr/Home.aspx Content-Length: 14762 Origin: http://www.imkb.gov.tr X-MicrosoftAjax: Delta=true Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Cache-Control: no-cache Accept: / User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: ASP.NET_SessionId=1gpydu4544juaf55h0xc3dus ctl00%24ScriptManager1=ctl00%24ScriptManager1%7Cctl00%24Timer1&ctl00_cphMenu_ctl00_RadTabstrip1_ClientState=%7B%22selectedIndexes%22%3A%5B%220%22%5D%2C%22logEntries%22%3A%5B%5D%2C%22scrollState%22%3A%7B%7D%7D&ctl00_cphChart_iseindexchart1_RadTabStrip1_ClientState=%7B%22selectedIndexes%22%3A%5B%220%22%2C%220%3A0%22%2C%221%3A0%22%2C%222%3A0%22%5D%2C%22logEntries%22%3A%5B%5D%2C%22scrollState%22%3A
snip
dGExJEdlbmVyaWNDb250ZW50MTUPFCsAAQUPR2VuZXJpY19Db250ZW50ZAUhY3RsMDAkY3BoU2FnQm9sdW0kR2VuZXJpY0NvbnRlbnQ0DxQrAAFkZAUvY3RsMDAkY3BoSGFsa2FBcnpWaWRlb0Jhbm5lciR0bV9HZW5lcmljQ29udGVudDEPFCsAAWRkBR5jdGwwMCRjcGhPcnRhMyRHZW5lcmljQ29udGVudDIPFCsAAWRkBSJjdGwwMCRjcGhQYXphcmxhciRHZW5lcmljQ29udGVudDEwDxQrAAEFD0dlbmVyaWNfQ29udGVudGQFKWN0bDAwJGNwaEd1bmx1a0J1bHRlbmxlciRHZW5lcmljQ29udGVudDEzDxQrAAEFD0dlbmVyaWNfQ29udGVudGST8UDQlpGnx0YBRFx4m7Y34D0U5A
And gets back something like this:
HTTP/1.1 200 OK Cache-Control: private Date: Sun, 03 Oct 2010 01:00:14 GMT Content-Type: text/plain; charset=utf-8 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Vary: Accept-Encoding Content-Length: 22017
62|updatePanel|ctl00_RadAjaxManager1SU||80|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusal100Panel|XU100 64.882,72 |80|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusal030Panel|XU030 82.390,23 |82|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusalMaliPanel|XUMAL 100.123,14 |82|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusalSinaiPanel|XUSIN 48.861,20 |140|updatePanel|ctl00_ctl00_cphTicker_ctl00_imageUlusal100Panel||140|updatePanel|ctl00_ctl00_cphTicker_ctl00_imageUlusal030Panel||141|updatePanel|ctl00_ctl00_cphTicker_ctl00_imageUlusalMaliPanel||142|updatePanel|ctl00_ctl00_cphTicker_ctl00_imageUlusalSinaiPanel||87|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusal100DegisimPanel| -1.36 %|87|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusal030DegisimPanel| -1.55 %|88|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusalMaliDegisimPanel| -2.01 %|89|updatePanel|ctl00_ctl00_cphTicker_ctl00_lblUlusalSinaiDegisimPanel| -0.13 %|0|hiddenField|_EVENTTARGET||0|hiddenField|_EVENTARGUMENT||14044|hiddenField|__VIEWSTATE|/wEPDwUENTM4MQ9kFgJmD2QWAgIDEGRkFg4CAw8WBB4HRW5hYmxlZGceCEludGVydmFsAqD+CmQCBw8PFgIeF0VuYWJsZUFqYXhTa2luUmVuZGVyaW5naGRkAgkPZBYCZg9kFgJmD2QWAmYPZBYCZg8QZGQWAWYWBGYPZBYCZg9kFgJmDw8WBh4EVGV4dAUIVMO8cmvDp2UeC05hdmlnYXRlVXJsBWVqYXZhc2NyaXB0Omxhbmd1YWdlQmFyc1snY3RsMDBfY3BoTGFuZ19jdGwwMF9mbGFnTGlzdF9jdG
snip
iPanel,ctl00$ctl00$cphTicker$ctl00$imageUlusal100Panel,ctl00$ctl00$cphTicker$ctl00$imageUlusal030Panel,ctl00$ctl00$cphTicker$ctl00$imageUlusalMaliPanel,ctl00$ctl00$cphTicker$ctl00$imageUlusalSinaiPanel,ctl00$ctl00$cphTicker$ctl00$lblUlusal100DegisimPanel,ctl00$ctl00$cphTicker$ctl00$lblUlusal030DegisimPanel,ctl00$ctl00$cphTicker$ctl00$lblUlusalMaliDegisimPanel,ctl00$ctl00$cphTicker$ctl00$lblUlusalSinaiDegisimPanel|2|asyncPostBackTimeout||90|9|formAction||Home.aspx|4|pageTitle||İMKB|98|scriptBlock|ScriptPath|/ScriptResource.axd?d=lcMagBepDm3uqEhp4ZZIkOfRuU_Z1n_24IMfgjw79puiRGCI0X9_3XYgvubs5myx0&t=4efa241b|98|scriptBlock|ScriptPath|/ScriptResource.axd?d=lcMagBepDm3uqEhp4ZZIkOfRuU_Z1n_23WPnJeX5XRrOvxpExhC2_vq3NYmi9puU0&t=4efa241b|581|scriptStartupBlock|ScriptContentNoTags|if(typeof ($telerik)!='undefined'&&!$telerik.isSafari){var links=document.body.getElementsByTagName('link');if(links&&links.length>0){var documentHead=document.getElementsByTagName('head')[0];if(documentHead){for(var i=links.length-1;i>=0;i--){var linkTag=links[i];if(linkTag.className=='Telerik_stylesheet'){var thLinks=documentHead.getElementsByTagName('link');if(thLinks&&thLinks.length>0){var j=thLinks.length-1;while(j>=0&&thLinks[j--].href!=linkTag.href){};if(j>=0){continue;};};if($telerik.isIE){linkTag=linkTag.cloneNode(true);};documentHead.appendChild(linkTag);};};};};};|3218|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() { $create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[{InitControlID : "ctl00_cphChart_iseindexchart1_RadTabStrip1",UpdatedControls : [{ControlID:"ctl00_cphChart_iseindexchart1_RadTabStrip1",PanelID:""},{ControlID:"ctl00_cphChart_iseindexchart1_RadMultiPage1",PanelID:""}]},{InitControlID : "ctl00_cphChart_iseindexchart1_RadMultiPage1",UpdatedControls : [{ControlID:"ctl00_cphChart_iseindexchart1_RadMultiPage1",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusal100",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusal030",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusalMali",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusalSinai",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_imageUlusal100",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_imageUlusal030",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_imageUlusalMali",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_imageUlusalSinai",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusal100Degisim",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusal030Degisim",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusalMaliDegisim",PanelID:""}]},{InitControlID : "ctl00_Timer1",UpdatedControls : [{ControlID:"ctl00_cphTicker_ctl00_lblUlusalSinaiDegisim",PanelID:""}]},{InitControlID : "ctl00_cphChart_iseindexchart1_RadTabStrip1",UpdatedControls : [{ControlID:"ctl00_cphChart_iseindexchart1_RadTabStrip1",PanelID:""}]},{InitControlID : "ctl00_cphChart_iseindexchart1_RadTabStrip1",UpdatedControls : [{ControlID:"ctl00_cphChart_iseindexchart1_RadMultiPage1",PanelID:"ctl00_RadAjaxLoadingPanel1"}]},{InitControlID : "ctl00_cphChart_iseindexchart1_RadMultiPage1",UpdatedControls : [{ControlID:"ctl00_cphChart_iseindexchart1_RadMultiPage1",PanelID:"ctl00_RadAjaxLoadingPanel1"}]}],"clientEvents":{OnRequestStart:"",OnResponseEnd:""},"defaultLoadingPanelID":"","enableAJAX":true,"enableHistory":true,"links":["App_Themes/imkbTheme/default.css","App_Themes/imkbTheme/Panelbar/styles.css","App_Themes/imkbTheme/TabStrip/styles1.css","App_Themes/imkbTheme/Telerik/Grid.Telerik.css","/WebResource.axd?d=amYphA-0bPJeUJ3f2MWC9cDMaVsfb5JruqQDL2BA-uj2wLoxdJspOYFmAQ64SpW0GsRili9aNLED-pMP967YKVx4BQvkVw41cVPpujevY6Wl4hwZKl5xHg2&t=633758219960000000","/Sitefinity/ControlTemplates/Search/searchCommonLayout.css","/WebResource.axd?d=amYphA-0bPK6q7TUfp4lRhfNYzJQ2FPpMyJO7CL6Be2RQT-3IpQ3emdqJw56-kOz38BtycR_5N65G73e9FwsqqCxydyqPEEOYiTmyBjqfpY5nfRdAEU44A2&t=633758219960000000"],"styles":[],"uniqueID":"ctl00$RadAjaxManager1","updatePanelsRenderMode":0}, null, null, $get("ctl00_RadAjaxManager1")); }); |
精彩评论