Bitcoin Forum
December 04, 2016, 06:41:03 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Need VB.NET help with Mt Gox API  (Read 2409 times)
binaryblue
Newbie
*
Offline Offline

Activity: 2


View Profile
July 10, 2011, 06:44:43 PM
 #1

Hi Bitcoin Forum. 

I'm writing a program that needs to grab info from the Mt. Gox API.  However, I can't even get the public info (Ticker Data, Market Depth, etc.).  I've tried using (with no success):

Code:
Dim wc As new System.Net.WebClient
wc.DownloadString(New Uri("http://mtgox.com/code/data/ticker.php"))


Below is from a different thread outside the newbies section on this site:  The person was able to get the public info though. 
Code:
    Function PostWebpageData(ByVal url As String, ByVal Data As String) As String
        If My.Computer.Network.IsAvailable Then
            Dim Client As New Net.WebClient

            Return (Client.UploadString(url, Data))
        Else
            MsgBox("Unable to acess the internet")
        End If

    End Function

In fact, when I go to http://mtgox.com/code/data/ticker.php in firefox, I get a prompt to download the PHP page, which does have info in it. 

Can anybody show me the code needed to get the public data from Mt. Gox's API?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480876863
Hero Member
*
Offline Offline

Posts: 1480876863

View Profile Personal Message (Offline)

Ignore
1480876863
Reply with quote  #2

1480876863
Report to moderator
1480876863
Hero Member
*
Offline Offline

Posts: 1480876863

View Profile Personal Message (Offline)

Ignore
1480876863
Reply with quote  #2

1480876863
Report to moderator
1480876863
Hero Member
*
Offline Offline

Posts: 1480876863

View Profile Personal Message (Offline)

Ignore
1480876863
Reply with quote  #2

1480876863
Report to moderator
runlinux
Hero Member
*****
Offline Offline

Activity: 567



View Profile WWW
July 10, 2011, 07:01:27 PM
 #2

i have a working bot and getting the public API was easy.

let me post a few snippets for you:

Code:
        html = ""

        myURL = "http://mtgox.com/code/data/ticker.php"

        winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
        winHttpReq.setTimeouts(60000, 60000, 60000, 60000)
        winHttpReq.Open("GET", myURL, False)
        winHttpReq.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

        On Error Resume Next
        winHttpReq.Send()

        html = winHttpReq.responseText

From there, you can parse the html and get what you need from it.

and for getting your own personal stuff:

Code:
Sub getBalance()
        'Get Balance???
        Dim postString As String
        Dim postArray() As Byte

        html = ""
        postString = "name=" & username & "&pass=" & password
        postArray = System.Text.Encoding.GetEncoding(1252).GetBytes(postString)

        myURL = "https://mtgox.com/code/getFunds.php"
        winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
        winHttpReq.setTimeouts(60000, 60000, 60000, 60000)
        winHttpReq.Open("POST", myURL, False)
        winHttpReq.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

        On Error Resume Next
        winHttpReq.Send(postArray)

        html = winHttpReq.responseText

    End Sub

same thing, just parse the html and you can see if it works or not.

binaryblue
Newbie
*
Offline Offline

Activity: 2


View Profile
July 10, 2011, 07:16:28 PM
 #3

Thanks runlinux!  Just what I needed.
runlinux
Hero Member
*****
Offline Offline

Activity: 567



View Profile WWW
July 10, 2011, 07:19:05 PM
 #4

glad i could help. I was scratching my head for a few weeks trying to get the posting of data working.

now, write a bot and rule the world!

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!