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

[µo°Ý]VBA§ì¨ú.PHP­¶°ÝÃD??

¦U¦ì°ª¤â±z¦n
http://www.gretai.org.tw/ch/stock/statistics/monthly/st44.php
»P¤W­zºô¯¸¬ÛÃþ¡A¦ý¥¦¿é¤J®É¦³¤G­Ó°Ñ¼Æ¡A¥Ø«e§ä¨ìªº°Ñ¼Æ¬O"yy"¡A·Q½Ð±Ð¤@¤U¦pªG¬O¦³stk_no»Pyy¡A¤U­±sendªºµ{¦¡¸Ó¦p¦ó­×§ï©O? ÁÂÁÂ
.Send ("stk_no=" & code)

TOP

heavenweaver±z¦n¡A

§Ú¤w¦³½Æ»s#12ªºSub WrittenByLalalada()¨Ó­×§ï
http://www.gretai.org.tw/ch/stock/statstics/monthly/download_st44.php
¤W¦Cºô§}¦³¤G­Ó°Ñ¼Æ¡A¤w±Nµ{¦¡§ï¼g¦p¤U¡A¦ý¦~«×ªºsend±ø¥óÁÙ¬O§ì¨ú¤£¨ì(µ{¦¡½X¦p¤U)¡AÁÂÁ±z
  1. Private Sub CommandButton1_Click()

  2. '«Å§iÅܼÆ
  3. Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
  4. Dim TMP As Workbook

  5. '²M°£Â¸ê®Æ
  6. Range("A4:Z2000").Select
  7. Selection.Clear

  8. code = Range("A1").Value  'ªÑ²¼¥N½X
  9. yy = Range("B1").Value  '¦~«×

  10.     '±N¸ê®Æ¥ý¦s¦ÜcÁV
  11.     With WinHttpReq
  12.     '.Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False
  13.     .Open "POST", Range("C1").Value, False
  14.     .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  15.     .Send ("stk_no=" & code & "yy=" & yy)
  16.            Set oStream = CreateObject("ADODB.Stream")
  17.            oStream.Open
  18.            oStream.Type = 1
  19.            oStream.Write WinHttpReq.ResponseBody
  20.            oStream.SaveToFile ("C:\" & code & ".csv")
  21.            oStream.Close
  22.     End With
  23. End Sub
½Æ»s¥N½X

TOP

heavenweaver±z¦n¡A

·Q¦V±z½Ð±Ð¡A¥ý«eª©¥»¨Ì·Ó±zªº«ü¾É¤w¥i¥¿±`¨Ï¥Î¡A¦ý¤µ¤é¾Þ§@®É¡Aµo²{excel¸ê®Æ¸ü¤£¤U¨Ó¡A¬O§_¬ÛÃö°Ñ¼Æ­n­×§ï©O? ÁÂÁ±z¡C
  1. Private Sub CommandButton4_Click()

  2. '«Å§iÅܼÆ
  3.    Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
  4.    Dim TMP As Workbook


  5. '²M°£Â¸ê®Æ
  6.    Range("F66:Z200").Select
  7.    Selection.Clear

  8.    code = Range("A1").Value  'ªÑ²¼¥N½X
  9.    yy = Range("H4").Value '¦~«×


  10. '±N¸ê®Æ¥ý¦s¦ÜcÁV
  11.    With WinHttpReq
  12.    .Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False
  13.    .Open "POST", Range("I4").Value, False
  14.    .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  15.    .Send "stk_no=" & code & "&yy=" & yy  '¶ÇªÑ²¼¥N½X¡B¦~«×°Ñ¼Æ
  16.           Set oStream = CreateObject("ADODB.Stream")
  17.           oStream.Open
  18.           oStream.Type = 1
  19.           oStream.Write WinHttpReq.ResponseBody
  20.           oStream.SaveToFile ("C:\" & code & "-M.csv")
  21.           oStream.Close
  22.    End With
  23.    

  24. End Sub
  25.    
½Æ»s¥N½X

TOP

heavenweaver±z¦n¡A

¨Ï¥ÎFiddler¤u¨ãµo²{ºô§}¦³²§°Ê¡A¤w§ä¨ì°ÝÃD¤F¡AÁÂÁ±z

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD