VBNet Sample (Yes really)

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #241
    You're welcome - it's beginning to seem epic - I'll be about 120 before I get it finished! I'll have a think about the video idea, but don't hold your breath! Hope yours is nearer to its end!

    Thanks for the info on the markets closing.

    Comment

    • SimonN
      Junior Member
      • Dec 2014
      • 71

      #242
      Hi,

      Anyone got a reasonably up to date list of all football teams in BF DB, please?

      I'm trying to take account in my programming for fixtures that have not yet been released by Betfair but need to know how BF has the teams listed in their DB in order to do so.

      For example: 'Llandudno v Bangor'. Neither team is currently in Events but if I had a list of what BF calls these teams I could save that instead and do an events name look up on a timer.

      Thank you.

      Si

      Comment

      • SimonN
        Junior Member
        • Dec 2014
        • 71

        #243
        Sorted thank you

        Comment

        • Sedgefield
          Junior Member
          • Apr 2009
          • 12

          #244
          I am using the basicapp and getting this error Create Request Error The server committed a protocol violation Section=Response Header Detail=Header name is invalid. Can anyone help please. Thanks. Oh I should add that I can log okay, the error only appears after a request to listmarketbook

          And finally changing ServicePointManager.Expect100Continue = True
          to ServicePointManager.Expect100Continue = False fixed it for me. Still not sure why though
          Last edited by Sedgefield; 07-08-2019, 10:09 AM. Reason: found an answer

          Comment

          • tippete
            Junior Member
            • Mar 2016
            • 42

            #245
            Found this program yesterday and downloaded the BasicApp. I managed to get it to list the races and could select markets.When i have tried today i get
            "Login problem. The request was aborted. Could not create ssl/Tls secure channel. Can anyone help?

            Comment

            • geoffw123
              Senior Member
              • Mar 2014
              • 250

              #246
              Hi

              Have you got a line

              ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

              Try adding that if you havent, see if it helps ?

              Comment

              • tippete
                Junior Member
                • Mar 2016
                • 42

                #247
                Thanks for prompt reply. I have tried this.

                request.Headers.Add(HttpRequestHeader.AcceptCharse t, "ISO-8859-1,utf-8")
                request.Headers.Add("X-Application", AppKey)
                request.Headers.Add("X-Authentication", SessToken)

                ServicePointManager.Expect100Continue = True
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

                it wont allow for the semi colon (character not valid)

                Comment

                • jabe
                  Senior Member
                  • Dec 2014
                  • 705

                  #248
                  Some languages need a semi-colon at the end of each statement. Visual Basic doesn't.

                  Comment

                  • geoffw123
                    Senior Member
                    • Mar 2014
                    • 250

                    #249
                    Hi

                    Yes that was a C# line I cut and pasted, hence needs a teeny syntax change. Did it fix it though ?

                    P.S I just noticed your line

                    ServicePointManager.Expect100Continue = True

                    is the wrong way around too. Try setting that to False
                    Last edited by geoffw123; 11-11-2020, 10:06 PM.

                    Comment

                    • tippete
                      Junior Member
                      • Mar 2016
                      • 42

                      #250
                      No. I'm afraid it didn't. Does anybody have a running copy of this ? I think i might have to upgrade the visual Basic.

                      Comment

                      • jabe
                        Senior Member
                        • Dec 2014
                        • 705

                        #251
                        Mine looks more like this; it's almost JSON rather than being two parameters.

                        Dim JSONByteData As Byte() = Encoding.UTF8.GetBytes(postData)
                        request.Method = "POST"
                        request.ContentType = "application/json-rpc"
                        request.ContentLength = JSONByteData.Length
                        request.Headers.Add("X-Application: " & appKey)
                        request.Headers.Add("X-Authentication: " & ssoid)
                        request.Headers.Add("Content-Encoding: gzip")

                        I only have the expect100 line in the login procedure.

                        Comment

                        • tippete
                          Junior Member
                          • Mar 2016
                          • 42

                          #252
                          sorry that was the wrong part of the code i posted, should have been.

                          Public Class Form1
                          Private Function LoginSession(username As String, password As String) As String
                          Dim ssoid As String = [String].Empty
                          Dim info As String()
                          Dim sessToken As String = ""
                          Try
                          Dim uri As String = String.Format("https://identitysso.betfair.com/api/login?username={0}&password={1}&login=true&redirec tMethod=POST&product=home.betfair.int&url=https://www.betfair.com/", username, password)
                          Dim myRequest As HttpWebRequest = DirectCast(WebRequest.Create(uri), HttpWebRequest)
                          myRequest.Method = "POST"
                          myRequest.Timeout = 5000
                          ServicePointManager.Expect100Continue = False
                          'ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

                          i added the 2 lines at the bottom. Last line is now commented out but still no luck.

                          Comment

                          • jabe
                            Senior Member
                            • Dec 2014
                            • 705

                            #253
                            I'll dig out my login procedure for you, but it'll be this evening, I'm afraid. I took it from a website somewhere but it's been so long I don't recall where. It works, but not perfectly, because I always get a couple of dialogue boxes up with errors I need to click past. I assume they're directly from Betfait. When I've run it in debug mode, for some reason it goes through the login code either two or three times, and I know I needed to add a check on the size of the ssid file.

                            Comment

                            • jabe
                              Senior Member
                              • Dec 2014
                              • 705

                              #254
                              I'm trying to remember/work out what on earth is happening with mine. I have the Expect100 line but not the SecurityProtocol one.

                              With mine (and remember I pinched the code from somewhere), it sets up a WebBrowser object, uses LoginForm.Show() to do the login processing, and when that's complete it creates cookies, which the prog then goes through till if finds the one it wants, then it saves the cookie data as another file. I think the idea behind this was to save me having to log in again and to save the program having to reload all the initial data.

                              *** As mentioned, my program saves me from having to login if it fails (it saves data to a file to avoid all the reloading). For this reason, I never bother to log off. I just leave the session to expire. I've just tried to log out and got your "Login problem. The request was aborted. Could not create ssl/Tls secure channel " message.

                              I'll carry on...

                              ...this makes things rather awkward. I can't log out, so I can't log in again until the session expires.
                              Last edited by jabe; 13-11-2020, 07:31 PM.

                              Comment

                              • tippete
                                Junior Member
                                • Mar 2016
                                • 42

                                #255
                                The LoginForm.Show() is used in Program for Betting (James Butler) but they look different versions of vb and i wouldn't know how to marry them together.

                                Comment

                                Working...
                                X