Class: HTClient

Source Location: /HTClient.php

Class Overview [line 65]

CHPP
   |
   --HTClient

Connection class for interaction with the online game Hattrick.

Author(s):

Version:

Copyright:

Variables

Constants

Methods


Inherited Variables

Inherited Constants

Inherited Methods

Class: CHPP

CHPP::__construct()
Constructor
CHPP::htCache()
Set or retrieve internal cache, required by interface 'HT_Module'.
CHPP::htFile()
Get values within specified Hattrick file, updating internal cache on success. User should provide key/values pais as parameters for the requested Hattrick page, plus some extra information:
CHPP::htUrl()
Store reference http server, or get it parsing suggested URL from Hattrick.


Class Details

Connection class for interaction with the online game Hattrick.

Using this class is allowed where access has been approved by Extralives AB, copyright owners of Hattrick: it is not allowed to use this class without a valid CHPP license. If you do so anyway, you risk losing your team!

This is an high-level framework that manages interaction with Hattrick servers, keeping care of storing fetched information within an internal cache that will prevent other outside HTTP connections when requesting the same data more times. However, you can obtain refreshed information simply unsetting wanted values, because the cache is directly available for every your need.

When creating a new instance of this class, you should pass an array that will be used as internal cache. It usually needs some configuration values in the form of key => value pairs, where key names start with "ht_". The most important configuration directive is "ht_application". This will be used as UserAgent for your application, as requested by CHPP rules. You should also provide the location for a file that will store needed cookies for quering Hattrick servers, specified within "ht_cookies" as a full path filename, that should be different for each user of your application.. A good example for the initial parameters is something like: 'ht_application' => 'MyChppApplication 1.0', 'ht_cookies' => '/tmp/HTHQ-'.session_id()

Other useful keys are: 'ht_events' => true (automatic download of request related events, if uncached); 'ht_fixtures' => true (automatic download of request related fixtures, if uncached); 'ht_matches' => true (automatic download of request related matches, if uncached); 'ht_namesadd' = string (add this string to a cutted version of names, if is shorter than original); 'ht_nameslen' = integer (automatic calculate other formats strings for names, if uncached); 'ht_players' => true (automatic download of request related players, if uncached); 'ht_refresh' => true (force cache updates);

These options may also be provided as additional local parameters to related functions.

[ Top ]


Class Variables


Class Methods

htCurrent

array htCurrent( [array $params = false])

[line 74]

Retrieve the main Hattrick files related to current user team, filling the specific cache slot 'Current'.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'ht_currencyrate' => convert economy currency

[ Top ]

htFindPlayer

array htFindPlayer( [string $id = false])

[line 122]

Search for specified player within the internal cache. When found, will eventually insert missing information about owning TeamID, that is fetched when calling htPlayers() instead of getting a specific one with htPlayer().

Tags:

  • return - Requested information, or false if not found
  • access - protected

Parameters:

  • string $id - PlayerID

[ Top ]

htFixtures

array htFixtures( [array $params = false])

[line 160]

Retrieve requested league fixtures from Hattrick servers, saving them to internal cache within the slot of related league level unit, sorted by season number.

When the season number is not specified whithin request parameters, then the current season is fetched by default, and the new key "CurrentSeason" is made available. When downloading data, retrieve also related matches from Hattrick servers if the value "ht_matches" is provided withing parameters or internal cache, fetching what is not already present. When asking for a specific match with htMatch(), this data will be then available without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs

[ Top ]

htLeagueLevelUnit

array htLeagueLevelUnit( [array $params = false])

[line 235]

Retrieve a League Level Unit from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

If the value "ht_fixtures" is provided withing parameters or internal cache, fetch related match list if are not already present. To directly fetch also specific matches information, you should use also 'ht_matches': when asking for a specific match with htMatch(), this data will be then available without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs

[ Top ]

htLeagues

array htLeagues( [ $params = false])

[line 200]

Retrieve the league details from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • $params -

[ Top ]

htLineup

array htLineup( [array $params = false])

[line 268]

Retrieve a match lineup from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'matchID' is required

[ Top ]

htLogin

array htLogin( [array $params = false])

[line 304]

User login asking to Hattrick servers for credentials validity.

Tags:

  • return - Login related information, or false on error
  • access - public

Parameters:

  • array $params - arguments

[ Top ]

htLogout

array htLogout( )

[line 328]

Close Hattrick session

Tags:

  • return - Best regards from Hattrick
  • access - public

Parameters:

[ Top ]

htMatch

array htMatch( [array $params = false])

[line 343]

Retrieve a match from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'matchID' is required

[ Top ]

htMatches

array htMatches( [array $params = false])

[line 412]

Retrieve requested match list from Hattrick servers.

If the value "ht_matches" is provided withing parameters or internal cache, will fetch also matches that are not already present. When asking for a specific match with htMatch(), this data will be then available without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs

[ Top ]

htMatchesArchives

array htMatchesArchives( [array $params = false])

[line 453]

Retrieve requested match list from Hattrick servers.

If the value "ht_matches" is provided withing parameters or internal cache, will fetch also matches that are not already present. When asking for a specific match with htMatch(), this data will be then available without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs

[ Top ]

htMatchEvents

array htMatchEvents( [array $params = false])

[line 379]

Retrieve a match description from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'matchID' is required

[ Top ]

htPlayer

array htPlayer( [array $params = false])

[line 498]

Retrieve a player from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

When downloading data, retrieve also related events from Hattrick servers if the value "ht_events" is provided withing parameters or internal cache, fetching what is not already present. This data will be then available for related functions, without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'playerID' is required, 'ht_currencyrate' => convert players salary

[ Top ]

htPlayerEvents

array htPlayerEvents( [array $params = false])

[line 541]

Retrieve every event related to a specific player from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'playerID' is required

[ Top ]

htPlayerNames

array htPlayerNames( [array $params = false])

[line 582]

Retrieve a list with player name in many different formats from the internal cache. If not present compose this information, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'playerID' is required

[ Top ]

htPlayers

array htPlayers( [array $params = false])

[line 653]

Retrieve requested players from Hattrick servers, saving each one to internal cache.

When asking for a specific player with htPlayer(), or a specific team again with this function, this data will be available without the need for other HTTP connections.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'ht_currencyrate' => convert players salary

[ Top ]

htTeam

array htTeam( [array $params = false])

[line 710]

Retrieve a team from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs when calling this function again with a specific TeamID.

If the value "ht_matches" is provided withing parameters or internal cache, fetch related matches thay are not already present. When asking for a specific match with htMatch(), this data will be then available without the need for other HTTP connections. That is valid also for team related players (using "ht_players").

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs

[ Top ]

htTrainingEvents

array htTrainingEvents( [array $params = false])

[line 743]

Retrieve every training event related to a specific player from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'playerID' is required

[ Top ]

htTransferHistory

array htTransferHistory( [array $params = false])

[line 784]

Retrieve every transfer event related to a specific player from the internal cache. If not present will fetch the requested information from Hattrick, saving it for future needs.

Tags:

  • return - Requested information, or false on error
  • access - public

Parameters:

  • array $params - Request paramaters as key/value pairs. 'playerID' is required 'ht_currencyrate' => convert economy currency

[ Top ]


Class Constants


Documentation generated on Wed, 15 Oct 2008 04:16:14 +0200 by phpDocumentor 1.4.1