Class: CHPP

Source Location: /CHPP.php

Class Overview [line 46]


Connection class for interaction with the online game Hattrick.

Author(s):

Version:

Copyright:

Variables

Constants

Methods


Child classes:

HTClient
Connection class for interaction with the online game Hattrick.

Inherited Variables

Inherited Constants

Inherited Methods



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!

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()

[ Top ]


Class Variables

$cache =  false

[line 50]

Internal cache array

Tags:

  • access - protected

Type: mixed

Overrides:

[ Top ]


Class Methods

__construct

CHPP __construct( [array $params = false])

[line 57]

Constructor

Tags:

  • access - public

Parameters:

  • array $params - Client information, used also as internal cache.

[ Top ]

htCache

array htCache( [array $params = false])

[line 70]

Set or retrieve internal cache, required by interface 'HT_Module'.

Tags:

  • return - Current value, or the updated one
  • access - public

Parameters:

  • array $params - New value

[ Top ]

htFile

array htFile( [array $params = false])

[line 97]

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:

'ht_page' => Required: Hattrick URI to call. 'ht_curl' => Optional: extra cURL parameters: useful if you need a proxy to contact Hattrick servers. 'ht_debug' => Optional: dump this string to error, followed by the json_encoded xml file. 'ht_method' => Optional: GET or POST, default is GET. 'ht_return' => Optional: you can use "xml" for plain XML output, "string" for the same output but parsing result within internal cache, or let it unset: by default htFile() returns an array that contains parsed information. 'ht_url' => Optional: defaults to fetched RecommendedURL.

Tags:

  • return - Requested information
  • access - public

Parameters:

  • array $params - Parameters

[ Top ]

htUrl

array htUrl( [string $val = false])

[line 207]

Store reference http server, or get it parsing suggested URL from Hattrick.

Tags:

  • return - Current value
  • access - protected

Parameters:

  • string $val - New value

[ Top ]


Class Constants


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