ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð±ÐMSXML2.XMLHTTP©MInternetExplorerªº²§¦P

[µo°Ý] ½Ð±ÐMSXML2.XMLHTTP©MInternetExplorerªº²§¦P

¦U¦ì¦n¡I¤p§Ì¦b³o¸Ì¬Ý¨ì¦U¦ì°ª¤âªºCODE¡A²×©ó²¤À´VBAªº¥Ö¤ò¡A´£¤É¤é±`¤u§@ªº®Ä²v¡AÁÂÁ¤j®a¡C¦ý
§Ú¹ïVBA«Ü¦h¦a¤è¤´µM¨S¯à´x´¤¡A§Æ±æ¤j®a¯à«ü±Ð«ü±Ð¡C
¦pªG§Úªºµ{§Ç»Ý­n¨ìºô¯¸§ä¸ê®Æ®É¡A§Ú·|¨Ï¥Î³o¨â²Õ¡G
  1. XMLHTTP= CreateObject("MSXML2.XMLHTTP.6.0")
  2. XMLHTTP.Open "GET", URL

  3. ©Î
  4. objIE = CreateObject("InternetExplorer.Application")
  5. objIE.Navigate URL
½Æ»s¥N½X
¨Ì§Ú²z¸Ñ¡A³o¨â²Õ¥N½X¬OŪ¨ú¸ÓPAGEªºHTML½X
¦ý§Ú¹ï¥¦­Ì¦³«Ü¦hºÃ°Ý¡G

1) MSXML2.XMLHTTP.6.0 ¥i¥H¥ÎPOST ©ÎGET ¡A«eªÌ»Ý­n§ÚSEND DATA¨ìºô¯¸§@¬d¸ß¡A¦ý
http://stock.finance.sina.com.cn/hkstock/finance/02317.html#a4
¦pªG§Ú·Q§ïÅÜ¥k­±¿ï¾ÜÄ檺³øªíÃþ«¬¡A¬O§_¥i¥H¥ÎMSXML2.XMLHTTP.6.0 ªºPOST & SENDªº¤èªk¡H¦ý§Ú¨S¦³¬ã¨s¦¨¥\¡A¥u¯à¥ÎobjIE = CreateObject("InternetExplorer.Application")¥h¾Þ§@

2) CreateObject("MSXML2.XMLHTTP.6.0")¬O§_¥i¥H§¹¥þ¨ú¥NCreateObject("InternetExplorer.Application")¡H¦³®É­Ô¦bLOOPING¡AIE·|°±¤î¤£°Ê¡A¦³ÂI³Â·Ð¡C

3) ¦b¨Ï¥ÎCreateObject("InternetExplorer.Application")®É¡A·í§Ú¶ñ¼g¤F¸ê®Æ¦A«ö.Submit«á¡A§Ú·|¦³¤@¬q¥N½X
  1. do until instr(.document.body.innerhtml,"XXX")>0
  2.         sleep 50
  3.         doevents
  4. loop
½Æ»s¥N½X
¨Ó§PÂ_¸Ó­¶­±¬O§_¤w§¹¦¨Åª¨ú(§Ú´¿¥ÎreadyState<>4¡A¦ý¦n¹³¥¢±Ñ)¡A¦pªG·í®Éºô³t¤£¨Î¡Aexcel·|Åã¥Ü¨S¦³.document.body.innerhtmlªºOBJECT(Ãþ¦üªº¦r²´)¡A§Ú»Ý­nRERUN¥N½X¤~¯àÄ~Äò¡C§Y¨Ï§Ú¥Î¡Gdo until not .document.body.innerhtml is nothing t¤]·|¥X²{ERROR....


4) §Ú·Q¥Î³o¨â²Õ¥N½XŪ¨ú³oºô¯¸ªº³ø»ù¸ê®Æ¡A¦ý¨â­Ó³£¤£¦¨¥\¡A¬Ý¤FŪ¦^¨ÓªºHTML CODE¡AªÑ»ù¸ê®Æ¬OªÅªº¡A¦ý§Úª½±µ¬Ý³o­Óºô¯¸®É¡A¥¦ªºHTML CODE¬O¥]¬A³ø»ù¸ê®Æ¡C³B²z³o¨Çºô¯¸®É¦³¨S¦³¯S§Oªº³B²z§Þ¥©¡H
http://www.etnet.com.hk/www/tc/stocks/realtime/quote.php?code=2317

¦^´_ 1# ¤p«L«È
1¡B§A¬O¥Î³o­Ó³sµ²´ú¸Õ¶Ü¡Hhttp://stock.finance.sina.com.cn/hkstock/api/jsonp.php/var%20tableData%20=%20/FinanceStatusService.getFinanceStatusForjs?symbol=02317&financeStatus=1
³Ì«áªºfinanceStatus¬O³øªíÃþ«¬¡Call¬O¥þ³¡¡Bzero¬O¦~³ø¡B1¬O¤¤³ø¡B2¬O¤@©u³ø¡B3¬O¤T©u³ø¡C

4¡B¨ººØÀ³¸Ó³£¬Ojavscript¬d¸ß¨Óªº¸ê®Æ¡A¦b­ì©lºô­¶ªºHTML¸Ì¬O§ä¤£¨ìªº¡C

TOP

¦^´_  ¤p«L«È
1¡B§A¬O¥Î³o­Ó³sµ²´ú¸Õ¶Ü¡H
³Ì«áªºfinanceStatus¬O³øªíÃþ«¬¡Call¬O¥þ³¡¡Bzero¬O¦~³ø¡B1¬O¤¤ ...
zyzzyva µoªí©ó 2016-8-24 22:31


Ãö©ó°ÝÃD1¡G§Ú¤£¬O°Õ¡A§Ú¨S¯à¬ã¨s¨ì³o­Ó³sµ²¡A§Ú¬Oª½±µ¥ÎMSXML2.XMLHTTP.6.0¨ì http://stock.finance.sina.com.cn/hkstock/finance/02317.html#a4
¦ý§Ú¤£À´¦p¦ó¥ÎPOST AND SEND ªº¤èªk§ï°ÊfinanceStatusªº¿ï¶µ¡A©Ò¥H§Ú¼È®É¬O¥ÎCREATEOBJECT("InternetExplorer.Application")¡A¦A§ï°ÊfinanceStatus ªºOBJECT¥hÀò±o·s¼Æ¾Ú¡C
¤j¤j«Ü§Q®`¡A¥i§_±Ð±Ð§Ú¦p¦ó¥h±o¨ì³o­Ó³sµ²¡HÁÂÁÂ

Ãö©ó°ÝÃD4¡G²{¦b§Ú³B²z¤èªk¬O¡ACREATEOBJECT("InternetExplorer.Application")¡A¨ì¸Óºô¯¸¡A­«·s¿é¤JCODE¦ASUBMIT¡A¥OHTML¥]§t¨ì¸ê®Æ¡A¤£¹L§Úı±o³o­Ó¤èªk¦³ÂIÄø......

TOP

¦^´_ 3# ¤p«L«È ¦pªG¬O¥ÎChrome¥i¥H«öF12¶}±Ò¶}µo¤H­û¤u¨ã¡A¦A«öF5­«Åªºô­¶Æ[¹î¡CFirefox¤]¦³Ãþ¦üªº¤u¨ã¡CIE¦n¹³¨S¦³¡A¥i¥H¸ËFidller,¤]«Ü¦h¤H¥Î¡C°ÝÃD4ª½±µ¥ÎÂsÄý¾¹¸ü¤JÀ³¸Ó¬O³Ì³æ¯Â¤F¡A¦pªG¯à§ä¨ì¥L¬d¸ßªºjavascript¤]³\¥i¥H¤£¥Î¸ü¤J¾ã­Óºô­¶¡A¤£µM¥Ø«e§Ú¤]¨S¦³§ó¦nªº¿ìªk¡C

TOP

¦^´_ 4# zyzzyva


    ­ì¨Ó¦³³o¼Ëªº¤u¨ã¡AÁÂÁ§Aªº«ü±Ð

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD