Page 1 of 1

Asp.Net API script

Posted: Sat Oct 15, 2011 2:10 pm
by Erkan
Hi,

Does anyone have asp.net api scripts like the sample's that Kent have on his site?

Erkan.

Re: Asp.Net API script

Posted: Mon Oct 17, 2011 11:25 am
by rjones33
Erkan,

I do all my programming in asp.net/vb.net. What specifically are you looking for?

Re: Asp.Net API script

Posted: Mon Oct 17, 2011 7:02 pm
by Erkan
I also do some programming in asp.net Vb but I am not a pro.
Just wondering how the API scripts Kent made in PHP look in VB so I can learn to make my own
scripts.

Regards,

Erkan.

Re: Asp.Net API script

Posted: Mon Nov 21, 2011 5:04 am
by Erkan
Can some give me a automated login API scrip for PM.
The same as Kent has in PHP but I want it in Asp.Net / VB.

Thanks.

Re: Asp.Net API script

Posted: Tue Nov 29, 2011 5:41 am
by slawek
That API libarary was created a while ago. Not all functions was implemented, just part of them for own needs.
Not sure if that works with current version of PM, but at least can direct you how to implement that with VB.NET.

To use that script:

Code: Select all

Private Const pokerAPIURL As String = "http://ipaddess:8087/api?"
Private Const pokerAPIPassword As String = "password"
Dim Results As String = ""
Dim pmAPI As New pokerAPI.PokerAPI(pokerAPIURL, pokerAPIPassword)
------------------------------------------------------------------------------------------
Public Sub examplesub(ByVal mUserName As String, ByVal mUserPassword As String)

        Results = ""

        Dim mData As New Hashtable

        Dim mPokerPlayer As New pokerAPI.pokerPlayer

        mPokerPlayer.Player = mUserName
        mPokerPlayer.PW = mUserPassword

        mData = mAPI.AccountsGet(mUserName)

       If mData("Result") = "Ok" Then

            'if user exist. then just update some data for user


            mData = mAPI.AccountsEdit(mUserName)

        Else

          'user not exist. create account
         
            mData = mAPI.AccountsAdd("playername")


        End If
       If mData("Result") <> "Ok" Then
        'for some reason can't create account
         Results =mData("Error")
          Exit Sub

       end if
       
       'we are cool. or user exist or just created.
       ' refresh user's data
        mData = mAPI.AccountsGet("playername") 
        Dim Balance as long
        Balance = mData("Balance")

       ' if user's balance less then 1000 chips increase it to 20000 chips
         
        If Balance <= 10000 Then

            mData = mAPI.AccountsIncBalance(mUserName, 20000)

        End If
       If mData("Result") <> "Ok" Then
          'error with balance increase
         Results =mData("Error")
         Exit Sub
       endif

End Sub