Lotto Predict

  • Home
  • Check Results
  • About Lotto Predict
  • Lotto Predict API
  • Changelog


  • LottoPredict API


    The LottoPredict API is accessible from api.bentasker.co.uk/lottopredict. Requests are made using variables in the URI (i.e. GET) and the following features are supported
    1. Retrieve Prediction
    2. Generate Lucky Dip (Up to 10 at a time)
    3. Check Results (Lotto and Thunderball)
    4. Retrieve Historical Draw Results
    All output is JSON encoded.

    Data Captured

    Generally speaking, the LottoPredict API wont store any data relating to requests. The only exception to this is when a set of numbers are submitted to the results checker. These numbers may be stored (but aren't currently) in order to help improve the statistical analysis when generating a prediction. The standard month-based checker doesn't store any data however.

    Any data stored is completely anonymous, only the submitted numbers and when they were submitted will be stored. Your API Key, accessing IP address etc will not be stored

    Things to be aware of

    The Prediction generated won't usually change between requests. The system has evaluated the options and reached what it believes to be the most probable outcome, unless new information is received that changes this, every visitor will see the same prediction every time they visit your page before the next draw. If you want to serve visitors different numbers you should use the Lucky Dip Functionality

    API Key

    All users are free to use the API Key 751fbf6ddfb7c3857d898c21bfdc2b22 but be aware that if it is abused access may be blocked for this key. Alternatively individual keys are available, Contact Me to have one generated (£1 per key - bargain!). Users abusing the system will be blocked, so consider use of the public API key a potential risk!

    Making a Request

    Making a request couldn't be simpler, simply send the request to http://api.bentasker.co.uk/lottopredict. Include the desired action (see below) as variable action, your API key as key and include any other variables required by your desired action

    Lucky Dip Generation

    To generate a lucky dip, use
  • action=LD
  • no=5 (Generate 5 lucky dips)
  • So an example request would be http://api.bentasker.co.uk/lottopredict/?action=LD&no=5&key= 751fbf6ddfb7c3857d898c21bfdc2b22

    Note: For Euromillions use action=ELD instead, for Thunderball use action=TLD

    Latest Results

    Supports Lotto, Thunderball and Euromillions. Withe latest results for the draw date you specify.
  • action=LatestResults
  • draws=Sat (Retrieve Saturday's result. Use 3 letter day names or Any)
  • game=1 (Check for lotto)
  • So to check the latest EuroMillions results we'd use http://api.bentasker.co.uk/lottopredict/?action=LatestResults&key =751fbf6ddfb7c3857d898c21bfdc2b22&game=3&draws=Any

    Check Results

    The system will check results for either Lotto or Thunderball. The easiest way is to retrieve all results for a given month, keep in mind that the date format needs to be YYYY-MM.
  • action=retrieve
  • month=2012-01 (Retrieve results for Jan 2012)
  • game=1 (Check Lotto Results, use 2 for Thunderball)
  • So an example request would be http://api.bentasker.co.uk/lottopredict/?action=retrieve&month=2012-01&key= 751fbf6ddfb7c3857d898c21bfdc2b22&game=1

    Check User Numbers

    The system will check for wins against user supplied numbers (as opposed to the Check Results request which does no comparison). All draws in the last 6 months will be checked (that being the limit for claiming). It will be possible to specify a time period when the API is next updated.
  • action=UserCheck
  • game=1 (for Lotto, 2 for Thunderball)
  • draws=Any (Can be Any, Mon, Tue, Wed, Thu, Fri, Sat Sun)
  • ball1=12 (Check for the number 12)
  • ball2 - 7 the same basis as ball1. Ordering does not matter (except for EuroMillions where Balls6 & 7 must be the lucky stars)
  • So an example request would be http://api.bentasker.co.uk/lottopredict/?game=1&action=UserCheck&key=751fbf6ddfb7c3857d898c21bfdc2b22&ball1=7&ball2=20&ball3=23&ball4=42&ball5=16&ball6=12&ball7=&draws=Any

    Please Note: For statistical purposes, some of the Content of these requests will be recorded. The submitted numbers (including when the numbers were submitted) will be stored. Other details such as the API Key, Client IP etc will not be stored.

    Get Game Identifiers

    To get an up-to-date list of Game ID's use action GameList or ListAllGames to retrieve a JSON encoded list of games and their ID's. The former will list only the games that your key can access, whilst the latter will list all available games.
    http://api.bentasker.co.uk/lottopredict/?action=GameList&key=751fbf6ddfb7c3857d898c21bfdc2b22

    Example Implementation

    You could use either an AJAX request (though some browsers will limit these to the current domain) or pull the data through using PHP. To use the latter method, you need only include the following in your code

    //Place an API request to get results for a given month
    
    $APIKEY = "751fbf6ddfb7c3857d898c21bfdc2b22";
    $results = file("http://api.bentasker.co.uk/lottopredict/?action=retrieve&month=$month&key=$APIKEY&game=1");
    
    // Read back each of the results
    foreach ($results as $result){
    
    $result = json_decode($result);
    
    // Always check for blank lines!
    if (empty($result->Date)){ continue; }
    
    // Output the data
    echo "Date: {$result->Date},  Draw ID: {$result->DrawID}" .
    "Balls: {$result->Ball1} {$result->Ball2} " .
    "{$result->Ball3} {$result->Ball4} " .
    "{$result->Ball5} {$result->Ball6}" .
    "{$result->Ball7}";
    
    
    
    /* Alternatively, if you don't need to access each of the balls individually use results raw echo "Date {$result->Date}, Draw ID: {$result->DrawID}" . "{$result->resultsraw }"; */
    }


    Alternatively you can use the example class provided here (doesn't include Euromillions support).

    Additional Games

    The next generation version of this API is now available - LotteryResultsOnline API - It supports many, many more games. It's unlikely that many (if any) new features will be added to LottoPredict, whilst the LotteryResultsOnline API is under ongoing development



    Copyright © 2012 Ben Tasker. All rights reserved.