getLottoResults(date('Y-m')); Output the returned content var_dump($results); */ class LottoPredict{ var $APIKEY = "9c59922ab287d59d06011a4c91a21fcf"; /** Check that the current APIKey is authorised and working * * @return true if the key is valid, false if not */ function checkAPIKey(){ if ($this->place_request("keyCheck","2")->row0->Status == "Approved"){ return true; } return false; } /** Retrieve Thunderball results for the given month * * @arg month - Date formatted YYYY-MM */ function getTBResults($month){ return $this->place_request("retrieve","2","month=$month"); } /** Retrieve Lotto results for the given month * * @arg month - Date formatted YYYY-MM */ function getLottoResults($month){ return $this->place_request("retrieve","1","month=$month"); } /** Generate lotto lucky dips. * * @arg number - The number of lucky dips to generate (max 10) * */ function generateLottoLD($number){ return $this->place_request("LD","1","no=$number"); } function place_request($action,$game,$additional = null){ // Place the request $results = file("http://api.bentasker.co.uk/lottopredict/?key={$this->APIKEY}&game=$game&action=$action&$additional"); // Process the response $X=0; foreach ($results as $result){ $result = json_decode($result); $key = "row$X"; $this->result->$key = $result; $X++; } return $this->result; } }