Error_in_order

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fred77
    Junior Member
    • Jan 2009
    • 37

    #16
    The API operates using GMT so you might as well too.

    Make sure your local time/date and timezone on your server is set properly and let PHP handle your timezone/date conversions, use gmdate() to generate GMT. E.g. here's something I use:

    PHP Code:
    $unixtime=time(); // unix timestamp for now
    $datetimefrom gmdate('Y-m-d\TH:i:s\Z'$unixtime+300); // Five minutes from now
    $datetimeto gmdate("Y-m-d\TH:i:s\Z"$unixtime+3*3600); // 3 hours from now 
    Use the visualiser to get an idea of what requests actually work and what the working json looks like.

    Comment

    • Ghostbusters 2
      Junior Member
      • Apr 2015
      • 16

      #17
      I've tried changing the timestamps without success. i don't think the error is in the time as it worked fine on the us server and i can change the time returned here but it makes no difference.
      i have emailed betfair and am waiting for a response.

      there's nothing in the json response about empty results, although it does already have some error handling. i wouldn't know where to even begin to look. what else could cause the same file run on one server and not another. it depends on curl and...?

      i'll do my best to try anything else that is suggested.

      what do you mean by use the visualiser to get an idea of what requests work and don't? aside from executing the operations listed on the left, is there anything else i can do with it to help me understand how the json requests are built up because that would be great!


      (As soon as this is sorted out, if i can't get the keep alive function to work, i'll need to make another thread about how to update the ssoid so a non interactive log in can remain logged in. but one step at a time. I just want to run one script once a day!)

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #18
        If you are using Chrome as a browser then you can use the Visualiser to build the required command and then hit F12 to see the actual JSON that was produced.

        There may well be equivalent commands in other browsers.

        Comment

        • Fred77
          Junior Member
          • Jan 2009
          • 37

          #19
          I think perhaps you should start with the sample PHP script and see if you can get that running on your server. If it doesn't work then set the DEBUG variable near the top of the script to true and maybe it'll show the issue. Curl is a likely contender.

          Re: visualisers, they let you get aquainted with the input parameters you may want to use and how they are expressed in valid JSON. If you enable the console/debug/javascript window the visualiser shows you the JSON requests and responses.

          Comment

          • Franklin1
            Junior Member
            • Mar 2012
            • 91

            #20
            ok, lets get this fixed.

            1 - I ran your request without issue (and got a successful response).
            1. Get horse racing market of all races.... Post Data: [{ "jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params" :{"filter":{
            "eventTypeIds":["7"], "marketCountries":["GB"], "marketTypeCodes":["WIN"], "marketStartTime":{
            "from":"2015-05-06T18:05:08+01:00"}},
            "sort":"FIRST_TO_START", "maxResults":"1000", "marketProjection": [ "RUNNER_DESCRIPTION" ]}, "id": 1}] Response: null
            2 - The visualiser would return the exceptions I was previously talking about in a message box

            3 - I think the best (and most useful in future) way to to work out the problem is to learn to process the betfair exceptions (which you said you can't find). Here is useful way to understand the requests and responses in more depth than the visualiser allows:
            a - Install HTTP Resource Test in Firefox
            b - add url, headers and http method

            c - add your JSON request as the body

            d - click submit and check out the response



            this one worked ok.
            If I create an error by chaning my app key I now get:


            Notice how the respose.body does not contain the List<MarketCatalogue> we were expecting, but instead an "error". Here is tells me "errorCode":"INVALID_APP_KEY". Your code should have some way of handling this "error", when it is returned.


            Can you get this error code now? If you don't want to use firefox & the extension try your request in the visualiser on the server and see if you can get a response.

            Comment

            • Franklin1
              Junior Member
              • Mar 2012
              • 91

              #21
              Fred's suggestion is a better place to start than mine

              Comment

              • Ghostbusters 2
                Junior Member
                • Apr 2015
                • 16

                #22
                Thanks very much for all the help! This is beginning to make a modicum of sense to me.
                i have found that there are many visualisers. playing with the betting one, i was able to start looking at the listMarketCatalogue in more detail.

                the ListMarketTypes, filtered by eventID 7, shows possible results, but it's a bit odd when i try those results in the catalogue. eg 'WIN' returns nothing, but 'WIN ' returns some results. same for antepost_win (it needs the space). some strings, like PLACE, don't mind if there's a space there or not.
                Adding a following space in the php file filters sadly gave the same response of null.

                The strangest thing about all of this is that running the files from my local computer all work perfectly! Running as a cron job from a US server breaks when placing of the bet (jurisdiction!) and running from a UK server, it returns nothing for the list!

                Comment

                • Ghostbusters 2
                  Junior Member
                  • Apr 2015
                  • 16

                  #23
                  Originally posted by Franklin1 View Post
                  Fred's suggestion is a better place to start than mine
                  yes, that is where i have begun, but i didn't know about the firefox addon which is pretty cool!

                  Comment

                  • Fred77
                    Junior Member
                    • Jan 2009
                    • 37

                    #24
                    One other thing for PHP, make sure that errors (even minor ones) aren't being silently hidden from you. Stick this at top of your script if you haven't already got something similar.

                    PHP Code:
                    ini_set('display_errors'1); // we're not in public so show errors
                    error_reporting(E_ALL); // lets see all error types to avoid sloppy programming 

                    Comment

                    • Ghostbusters 2
                      Junior Member
                      • Apr 2015
                      • 16

                      #25
                      thanks!
                      I've added that and run it but it reports the same as always.

                      latest update is that it seems my uk server is running a slightly older version of php so am trying to get that updated, and hoping that that will fix it!

                      Comment

                      Working...
                      X