Hall of Fame

These respected pieces of code are all in the PHT Hall of Fame.

Most of them don't works nowadays as Hattrick has evolved, but you can download all versions if you want to see the code, or if you have a bit of nostalgia about old things of the game :)

  • Download PHT v2.13.3

    v2.13.3 24-04-2012

    New getPlayerTypeSearch() and getLastCallDate() functions in HTYouthScout class

    Fix HTYouthPlayer class
    Fix getYouthPlayer() function in HTYouthTeamPlayers class
  • Download PHT v2.13.2

    v2.13.2 17-04-2012

    Fix getXml() function in HTXml class
  • Download PHT v2.13.1

    v2.13.1 13-04-2012

    Fix isTrainer() function in HTPlayer class
  • Download PHT v2.13

    v2.13 12-04-2012

    Use version 2.3 of matchdetails file
    Use version 2.1 of matchorders file
    Use version 1.8 of matchlineup file
    New getTournamentMatchDetails(), clearTournamentMatchDetail() and clearTournamentMatchesDetails() functions in CHPPConnection class
    New isYouth() and isTournament() functions in HTMatch class
    New getSeniorMatchOrders(), clearSeniorMatchOrders(), clearSeniorMatchesOrders() functions in CHPPConnection class
    New getYouthMatchOrders(), clearYouthMatchOrders(), clearYouthMatchesOrders() functions in CHPPConnection class
    New getTournamentMatchOrders(), clearTournamentMatchOrders(), clearTournamentMatchesOrders() functions in CHPPConnection class
    New getTournamentLineup(), clearTournamentLineup(), clearTournamentLineups() functions in CHPPConnection class
    New isTournament() and isYouth() functions in HTTeamMatch class
    New getFirstName(), getLastName() and getNickName() functions in HTMatchOrdersPlayer class
    New getSourceSystem() function in HTSetLineup class
    Change CHPPConnection::oauthFirstTokenSecret scope, now the variable is protected
    New getGoalsInCareer(), getGoalsInCup(), getGoalsInLeague(), getGoalsInFriendly() and getHattricksInCareer() function in HTPlayer class

    Fix getKey(), getKeyId() and getKeyVariation() functions in HTLiveMatchEvent class
    Fix HTYouthPlayerSkill class
    Fix getEndDate() function in HTMatch class
    Fix getPlayerById() function in HTAvatars class
    Fix getXml() function in HTXml class

    Parameters of createNewLineup() function in CHPPConnection class have changed: $isYouth boolean parameter has changed to $sourceSystem string parameter, use HTMatch constants to set the value for your lineup
    Constructor parameters of HTSetLineup have changed, $isYouth boolean parameter has changed to $sourceSystem string parameter, use HTMatch constants to set the value for your lineup

    Remove isYouth() function in HTSetLineup class

    Functions getMatchOrders(), clearMatchOrders() and clearMatchesOrders() in CHPPConnection is marked as deprecated. Will be removed within next version
  • Download PHT v2.12

    v2.12 10-03-2012

    Use version 2.4 of matches file
     Use version 2.2 of matchdetails file
     Use version 1.4 of leaguedetails file
     Use version 1.7 of matchlineup file
     Use version 1.0 of youthteamdetails file
     Use version 1.0 of youthavatars file
     Use version 1.0 of youthplayerlist file
     Use version 1.4 of allianceDetails file
     Use version 2.2 of players file
     Use version 2.1 of playerdetails file
     Use version 1.2 of worldcup file
     New clearHofPlayers() and clearAllHofPlayers() in CHPPConnection class
     New getKeyId() and getKeyVariation() functions in HTLiveMatchEvent class
     New getWonNumber(), getDrawsNumber() and getLostNumber() functions in HTLeagueTeam class
     New getFirstName(), getLastName() and getNickName() functions in HTLineupPlayer class
     New getTotalInjuries() and getInjury() functions in HTMatch class
     New HTMatchInjury class
     New getCurrentMatchRound() function in HTLeague class
     New getDressURI() and getDressAlternateURI() functions in HTNationalTeamDetail class
     New getYouthTeam(), clearYouthTeam() and clearYouthTeams() functions in CHPPConnection class
     New HTYouthTeam class
     New getYouthScouts(), clearYouthScouts() and clearAllYouthScouts() functions in CHPPConnection class
     New HTYouthScouts ans HTYouthScout classes
     New clearAvatars(), getYouthAvatars() and clearYouthAvatars() functions in CHPPConnection class
     New HTYouthAvatars and HTYouthPlayerAvatar classes
     New getYouthTeamPlayers(), clearYouthTeamPlayers() and clearYouthTeamsPlayers() functions in CHPPConnection class
     New getYouthTeamPlayersDetails() and clearYouthTeamsPlayersDetails() functions in CHPPConnection class
     New getYouthTeamPlayersUnlockskills() and clearYouthTeamsPlayersDetails() functions in CHPPConnection class
     New getYouthPlayer(), clearYouthPlayer() and clearYouthPlayers() functions in CHPPConnection class
     New HTYouthTeamPlayers, HTYouthPlayer, HTYouthPlayerLastMatch, HTYouthScoutCall, HTYouthScoutComment and HTYouthPlayerSkill classes
     New parameter in getInvestment() function in HTYouthSquad class
     New HTCommonAvatar class, internal class base for all avatars
     New getBackground() and getHtml() functions in HTPlayerAvatar class
     New getMaximumMember(), getRequestType() and getDescription() functions in HTAllianceRole class
     New isYouth(), getLeagueId(), getLeagueName(), getLeagueLevelUnitId(), getLeagueLevelUnitName() and getLeagueLevel() functions in HTTeamMatches class

     Fix getLeague() function in HTWorldDetails class
     Fix all functions which deal with dates, caches for date formats are integrated transparently
     Fix phpdoc for getAvatars() function in CHPPConnection class
     Fix getSpecialists() function in HTClub class to handle several calls with differents currencies
     Fix isInCup() function in HTTeam class

     Remove getAllianceRoleDetails(), clearAllianceRoleDetails(), clearAllianceRolesDetails(), and clearAlliancesRolesDetails() functions in CHPPConnection class
     Remove HTAllianceRoleDetails class because of non existence anymore of actionType viewRole in alliancedetails file
     Remove getBestMatch() functions in HTTeamPlayer and HTPlayer classes as data is no more available

     Function getPositionCode() in HTLineupPlayer is marked as deprecated. Will be removed within next version
     Functions getDressCode() and getDressAlternateCode() in HTNationalTeamDetail class are marked as deprecated. Will be removed within next version
  • Download PHT v2.11

    v2.11 20-01-2012

    Use version 1.7 of live file
    New getNextMinuteEvent() function in HTLiveMatch class
    New getHomeStartingLineup() and getAwayStartingLineup() functions in HTLiveMatch class
    New boolean parameter to include substitutes for getTotalStars() and getTotalStarsAtEndOfMatch() in HTFinalLineup class. Defaut value true, like before

    Fix isInCup() function in HTTeam class

    Function getStartingLineup() in HTLiveMatch is marked as deprecated. Will be removed within next version
  • Download PHT v2.10.1

    v2.10.1 08-11-2011

    Fix HTLineupResult constructor
    Fix mergeLiveJson private function
  • Download PHT v2.10

    v2.10 27-10-2011

    Use version 1.8 of matchorders file
    Use version 1.6 of matchlineup file
    Use version 1.4 of worlddetails file
    Use version 2.1 of players file
    Use version 2.0 of playerdetails file
    Use version 1.6 of live file
    New isDeleted() function in HTTeam class
    New parameter for HTError constructor, the exception code, used for lineup error
    New getOrderType() function in HTMatchOrdersPlayerOrder class
    New createNewLineup() and sendLineup() functions in CHPPConnection class
    New HTSetLineup, HTLineupSubstitution and HTLineupResult classes
    New HTSubstitutionLineup, HTStartingLineup and HTFinalLineup classes
    New getStartingLineup(), getFinalLineup(), getSubstitutionNumber() and getSubstitution() functions in HTLineup class
    New getLeagueNumber() in HTWorldDetails class
    New parameter includeRegions in getWorldDetails() function in CHPPConnection class
    New getWorldDetailsByCountryId(), clearWorldDetailsByCountryId(), getWorldDetailsByLeagueId() and clearWorldDetailsByLeagueId() functions in CHPPConnection class
    New getSeasonOffet(), getCountryDateFormat(), getCountryTimeFormat(), getRegionsNumber() and getRegion() functions in HTWorldLeague class
    New HTWorldRegion class
    New getLoyalty() and hasMotherClubBonus() in HTTeamPlayer class
    New getLoyalty() and hasMotherClubBonus() in HTPlayer class
    New parameter includeStartingLineup in getLive() function in CHPPConnection class
    New getSubstitutionNumber(), getSubstitution(), getStartingLineup() and getLastEventIndexShown() functions in HTLiveMatch class

    Fix urlencodeRfc3986() function in CHPPConnection class
    Fix getRatingStarsAtEndOfMatch() function in HTLineupPlayer class
    Fix isTrainer() in HTPlayer class
    Fix getStatement() and getShirtNumber() functions in HTTeamPlayer class
    Fix getShirtNumber() function in HTPlayer class

    Remove getPlayersNumber() and getPlayer() functions in HTLineup class
    Remove getPosition() function in HTLineupPlayer class
    Remove deprecated function getNumberOfVitories() in HTTeam class
    Remove deprecated function getNumberTransfersDuringPeriod() in HTTeamTransferHistory class

    Change internal fetchUrl(), buildUrl() and buildSignature() functions in CHPPConnection class
    Function getTotalLeague() on HTWorldDetails class is marked as deprecated, use getLeagueNumber() function instead. Will be removed within next version
    Function checkInitLive() on CHPPConnection class is marked as deprecated, the function don't do anything. Will be removed within next version
  • Download PHT v2.9

    v2.9 05-07-2011

    Use version 1.7 of nationalteamdetails file
    Use version 1.7 of matchorders file
    New getLogoUrl() function in HTNationalTeamDetail class
    New getSeasonExpectation() function in HTFans class
    New getNumberTransfers() function in HTTeamTransferHistory class, it replaces getNumberTransfersDuringPeriod() function
    New getNumberOfVictories() function HTTeam class, it replaces getNumberOfVitories() function (typo)
    New enableHTSupporter(), disableHTSupporter() and resetHTSupporter() functions in CHPPConnection class. It allows you to query xml by forcing to be HT Supporter or not

    Fix private function getTeams() in HTLeagueSeason class

    Function getNumberTransfersDuringPeriod() in HTTeamTransferHistory class is marked as deprecated and will be removed within next version
    Function getNumberOfVitories() in HTTeam class is marked as deprecated and will be removed within next version (typo function name)

    Remove getMatchId() and getTeamId() functions in HTMatchOrdersPlayerOrder class as xml tags were removed
  • Download PHT v2.8

    v2.8 19-06-2011

    Use version 1.9 of playerdetails file
    Use version 2.0 of players file
    Use version 1.4 of arenadetails file
    Use version 1.3 of alliances file
    Use version 1.4 of cupmatches file
    New HTPlayerMatch class, replace HTPlayerBestMatch and HTPlayerLastMatch classes
    New getPlayedMinutes() function in HTPlayerMatch class
    New getBestMatch() function in HTTeamPlayer class
    New getLeagueId() and getLeagueName() functions in HTArenasStatsArena class
    New getUserAlliances() function CHPPConnection class
    New startLog(), stopLog(), canLog() and log() functions in CHPPConnection class

    Fix getRegionId() function in HTArenasStatsArena class
    Fix isPositionChangeAvailable() function in HTLeagueTeam class
    Fix getLastMatch() and getBestMatch() functions in HTPlayer and HTTeamPlayer classes
    Fix scope of $oauthFirstTokenSecret variable in CHPPConnection class

    Remove UNAVAILABLE constant in HTLineupPlayer class, getRatingStars(), getPosition() and getIndividualOrder() functions return null instead of this constant
    Remove UNAVAILABLE constant in HTLeagueMatch class, getHomeGoals() and getAwayGoals() functions return null instead of this constant
    Remove UNAVAILABLE constant in HTTransfer class, getType() function returns null instead of this constant
    Remove UNAVAILABLE constant in HTTeamMatch class, isOrdersGiven() function returns null instead of this constant
    Remove UNAVAILABLE constant in HTMatchTeam class, getAttitude() function returns null instead of this constant
    Remove UNAVAILABLE constant in HTArenaCapacity class, isLastRebuildDateAvailable() and getExpansionDate() functions return null instead of this constant
    Remove UNAVAILABLE constant in HTMatchOrdersPlayer class, getIndividualOrder() function returns null instead of this constant
    Remove UNAVAILABLE constant in HTArenasStats class, getLeagueName() function returns null instead of this constant
    Remove UNAVAILABLE constant in HTAllianceDetails class, getAbbreviation(), getHomepageUrl(), getMessage(), getLogoUrl(), getNumberAwaitingRequests() and getDissolutionDate() functions return null instead of this constant
    Remove deprecated function isDataAvailable() in HTTrainingEvents class
  • Download PHT v2.7

    v2.7 17-04-2011

    Use version 1.2 of transfersteam file
    Use version 2.6 of teamdetails file
    Use version 1.6 of nationalteamdetails file
    Use version 1.2 of economy file
    Use version 1.1 of fans file
    New version 1.0 of file hofplayers
    New version 1.0 of file avatars
    New getTeamFlags(), clearTeamFlags(), clearTeamsFlags(), getTeamFlagsByUserId(), clearTeamFlagsByUserId() and clearTeamsFlagsByUserId() functions in CHPPConnection class
    New HTTeamFlags class, extends HTTeam class. Use to retrieve flags for teams
    Change getTeam() and getTeamByUserId() functions in CHPPConnection class, remove $includeDomesticFlags parameters. Use getTeamFlags functions to get flags for teams
    New getTeamSupporters(), clearTeamSupporters(), clearTeamsSupporters(), getTeamSupportersByUserId(), clearTeamSupportersByUserId() and clearTeamsSupportersByUserId() functions in CHPPConnection class
    New HTTeamSupporters class, extends HTTeam class. Use to retrieve supporters for teams
    New HTTeamSupporter and HTTeamSupported classes
    New get442Experience() function in HTNationalTeamDetail class
    New getSoldPlayers() and getSoldPlayersCommission() functions in HTEconomyIncome class
    New getBoughtPlayers() and getArenaBuilding() functions in HTEconomyCosts class
    New getFanClubId() and getFanClubName() functions in HTFans class
    New getTrophyNumber() and getTrophy() function in HTTeam class
    New HTTrophy class
    New getHofPlayers() function in CHPPConnection class
    New HTHofPlayers and HTHofPlayer classes
    New getAvatars() function in CHPPConnection class
    New HTAvatars, HTAvatar and HTLayer classes

    Fix get433Experience() function in HTTraining class
    Fix getNumberTeams() function in HTWorldCupGroup class
  • Download PHT v2.6

    v2.6 30-03-2011

    Use version 1.9 of training file
    Use version 1.3 of cupmatches file
    Use version 1.8 of playerdetails file
    Use version 1.9 of players file
    Use version 2.5 of teamdetails file
    Use version 1.4 of nationalteams file
    Use version 1.3 of worlddetails file
    Change getTrainingStats() function in CHPPConnection class, empty leagueId returns global stats
    Add getLastTrainingTrainingType(), getLastTrainingTrainingLevel() and getLastTrainingStaminaTrainingPart() functions in HTTraining class
    Add getHomeTeamId() and getAwayTeamId() functions in HTCupMatch class
    Add includeMatchInfo parameter to getPlayer(), getTeamPlayers(), getTeamOldPlayers() and getTeamOldCoaches() functions in CHPPConnection class, default value set to false
    Change getStamina() function in HTPlayer class, value is available even player others skills are not shown
    Add getOwnerNotes(), getCategoryId() and getBestMatch() functions in HTPlayer class
    New HTPlayerBestMatch class and HTPlayerLastMatch inherit from this class
    Add getLastMatch() function in HTTeamPlayer class
    Add getFanClubSize() function in HTTeam class
    Change getFanClubId() and getFanClubName() functions, make them available for everyone (not only htsupporters)
    Add getLeagueId() function in HTNationalTeamsTeam class
    Add getNationalTeamId() and getU20TeamId() functions to HTWorldLeague class
    Add withdrawChallenge() function in CHPPConnection class, this function needs OAuth privileges
    Add invalidateToken() function in CHPPConnection class
    Add isValid() function in HTCheckToken class
    Add getTeamId() and getTeamName() class in HTPlayer class
    Change getSeniorMatchDetails() function in CHPPConnection class: add new parameter matchEvents set to true by default
    Change getYouthMatchDetails() function in CHPPConnection class: add new parameter matchEvents set to true by default

    Fix getMatch() function in HTNationalMatches class
    Fix getSeriesMatchDate() function in HTWorldLeague class
    Fix getTeamRank(), getNumberOfUndefeat(), getNumberOfVitories() in HTTeam class
    Fix getMyArenaStats() and getOthersArenasStats() function in CHPPConnection class
    Fix isTrainer() function in HTTeamPlayer class
    Fix getName() function in HTRegion class

    PHP 5.3 compatibility: Fix all functions that use deprecated ereg() function, replaced by preg_match() function
    Change functions visibility from private to protected in CHPPConnection class
    Change properties visibility from private to protected for $signatureMethod and $version in CHPPConnection class (properties used for oauth)

    Function isDataAvailable() on HTTrainingEvents is marked as deprecated and returns always true. Will be removed within next version
  • Download PHT v2.5

    v2.5 16-01-2011

    Use version 1.5 of live file
    Use version 2.0 of matchdetails file
    Use version 1.5 of nationalteamdetails file
    New getIndirectSetPiecesDefenseRating() and getIndirectSetPiecesAttackRating() functions in HTMatchTeam class
    New get523Experience(), get550Experience() and get253Experience() functions in HTNationalTeamDetail class
    New getNationalTeamNumber() and getNationalTeam() functions in HTTeam class
    New HTTeamNationalTeam class to get national teams coached by user of selected team

    Fix getTrainingType() function in HTTrainingStats class, use index instead of type value
  • Download PHT v2.4

    v2.4 29-12-2010

    New getAuthenticateUrl() function in CHPPConnection class. Use to get a temporary token with one-time authorization htmail
    New checkToken() function in CHPPConnection class. Check if a token is still valid
    New HTCheckToken class to know related informations on a token (this object is returned by checkToken() function)
    Use version 1.6 of playerdetails file
    New getNativeCountryId() function in HTPlayer class

    Fix getRedCard() function in HTMatch class
    Fix includeDomesticFlags for getTeam() and getTeamByUserId() functions in CHPPConnection class

    Remove supporter check in getNumberFlagsHome(), getNumberFlagsAway(), getFlagHome(), getFlagAway() functions in HTTeam class

  • Download PHT v2.3

    v2.3 24-11-2010

    Use version 1.1 of achievements file
    New getRank() function in HTAchievement class
    New boolean parameter includeDomesticFlags for getTeam() and getTeamByUserId() functions in CHPPConnection class
    New getYouthTeamName() in HTTeam class
  • Download PHT v2.2

    v2.2 22-11-2010

    Use version 1.5 of playerdetails file
    New getLastMatch() function in HTPlayer class and new HTPlayerLastMatch class

    Fix getHatStats() function in HTMatchTeam class
    Fix getText() function in HTLiveMatchEvent class

    Remove deprecated functions: HTMatchTeam::getDressCode(), HTNationalTeamsTeam::getDressCode(), CHPPConnection::getChallanges(), CHPPConnection::clearChallanges(), HTTeam::getDessCode(), HTTeam::getDessAlternateCode()
  • Download PHT v2.1

    v2.1 13-11-2010

    Use https for OAuth proccess
    OAuth scope supported, set your scope on getAuthorizeUrl() function

    New manage challenges: CHPPConnection::getChallengeableTeams(), challengeTeam(), acceptChallenge(), declineChallenge()
    New constants in HTChallenges class to use with challengeTeam() function
    New player skills functions in HTTeamPlayer class
    Use version 1.6 of training file
    New functions getSpecialTrainingPlayerNumber() and getSpecialTrainingPlayer on HTTraining class
    New HTSpecialTrainingPlayer class
    Fix team details filename

    Deprecated function: getChallanges() and clearChallanges() use getChallenges() and clearChallenges() instead

    Remove getHost() function
    Remove deprecated functions: getFlagsHome(), getFlagsAway(), clearFlagsHome() and clearFlagsAway() in CHPPConnection class
    Change some internal constant (for server url)
  • Download PHT v2.0

    v2.0 26-10-2010

    Use new OAuth authentication
    Functions getLoginResult() and disconnect() have been removed.
    No more cookie are used
    Use version 2.4 of teamdetails file
    Use version 1.5 of training file
    Use version 1.7 of players file
    Use version 1.9 of matchdetails file
    Use version 1.4 of nationalteamdetails file
    Use version 1.2 of club file
    New functions getDressURI() and getAlternateDressURI() on HTTeam, HTMatchTeam and HTNationalTeamsTeam classes. Functions getDess() and getAlternateDess() are deprecated.
    Add functions get442Experience(), get523Experience(), get550Experience(), get253Experience() on HTTraining class
    All match events included
    Remove functions getKeeperTrainers(), getKeeperTrainersCost(), getEconomists() and getEconomistsCost() on HTSpecialists class
    Remove useStageAtYourOwnRisk() function as there is no stage server for OAuth system.
  • Download PHT v1.16

    v1.16 28-08-2010

    Use version 2.3 of team file
    New function on HTTeam class: getNumberFlagsHome(), getNumberFlagsAway(), getFlagHome(), getFlagAway()
    New HTTeamFlag class, used with HTTeam class
    Fix HTLeagueSeason when several teams get exactly same standings

    Remove deprecated HTMatchTeam::getMiedfieldRating() function

    Mark CHPPConnection::getFlagsHome() and CHPPConnection::getFlagsAway() as deprecated
    Use HTTeam::getFlagHome() and HTTeam::getFlagAway() functions instead, deprecated function will be removed next version
  • Download PHT v1.15

    v1.15 17-06-2010

    Enhance HTLeagueSeason, for any season you can get all teams datas (id, name, position, points, matches played, won, lost, draw, goals for, goals against, goal average)
    Use version 1.4 of matchlineup.xml
    Use version 1.5 of matchorders.xml
    Use new RoleID for players in lineup
    New getNewPosition() function on HTMatchOrdersPlayer class
  • Download PHT v1.14.1

    v1.14.1 19-10-2009

    Fix HTNationalPlayers::getPlayer() function
  • Download PHT v1.14

    v1.14 02-10-2009

    Fix HTTeam::isLeagueLevelAvailable() function
    Fix a bug in xml files transfer when safe mode enabled

    Enhance cookie management
    No more file used, all is in memory : xml transfer process is a bit quicker.
    Support of cookie change each 20 minutes : You can have script running without time limit
    CHPPConnection construct has one parameter less, use : $HT = new CHPPConnection('name', 'chppId','chppKey');
  • Download PHT v1.13

    v1.13 20-08-2009

    New version of pages: Alliance, AllianceDetails, MatchsDetails, Players, PlayerDetails, PlayerEvents, TeamDetails, Training, TrainingEvents
    New function getNumberOfVisits() in HTTeam class

    Fix some phpdoc comments

    Rename getMiedfieldRating() function to getMidfieldRating() in HTMatchTeam class.
    getMiedfieldRating() is now deprecated and will be removed next version, please update your code.

    Remove hasClubHouse() function as tag was removed in xml files
  • Download PHT v1.12

    v1.12 30-06-2009

    Fix define version of all xml files
    Fix economy functions which use Available attribute
    Fix functions which returns boolean, use same compare method in all functions
    Fix HTNationalTeamDetail class, remove isMoraleAvailable(), isSelfConfidenceAvailable(), isSupportersPopularityAvailable() and isRatingScoreAvailable() functions

    New live version 1.4
    - addLiveMatch() and deleteLiveMatch() have new boolean parameter: isYouth for a youth match or not, default false
    - New getEventByOrder($order) function: Get events by order of appearance

    Remove HTTeam::isFriendlyAvailable() function as data is removed from xml
  • Download PHT v1.11

    v1.11 25-06-2009

    Fix all functions using 'Index' attribute, now using xml nodes count
  • Download PHT v1.10

    v1.10 17-05-2009

    New getFetchedDate(), getXmlFileName() and getXmlFileVersion() functions in HTGlobal class, all functions are accessibles by all classes which request a xml file

    Fix CHPPConnection::searchPlayerByName() function, leagueId is corrected send to request
    Fix HTNationalPlayers::getPlayer() function
  • Download PHT v1.9

    v1.9 21-02-2009

    New player xml : version 1.4
    New match orders xml : version 1.4
    New events 187 and 287
    New getLanguageId() function in HTPlayer class
    New isPlayingMatch() function in HTTeamPlayers class
    New HTMatchOrdersPlayerOrder object, you can know orders given for a match:
    - get number of orders given
    - get each order and know all parameters (which minute, which condition, which player, ...)
    - get number of orders by player
    - get orders by player

    Fix events 350, 351, 352
    Fix HTMatchTeam::getAttitude()
    Fix HTArenaCapacity::isLastRebuildDateAvailable() and HTArenaCapacity::getExpansionDate()
    Fix HTMatchOrdersPlayer::getIndividualOrder()
    Fix HTArenasStats::getLeagueName()
    Fix getAbbreviation(), getHomepageUrl(), getMessage(), getLogoUrl(), getNumberAwaitingRequests(), getDissolutionDate in HTAllianceDetails class
    Fix HTLeagueMatch::getHomeGoals(), HTLeagueMatch::getAwayGoals()
    Fix HTTransfer::getType()
    Fix getGoalsInLeague(), getGoalsInCup(), getGoalsInFriendly(), getGoalsInCareer(), getHattricksInCareer(), getCards(), getInjury(), isTransferListed(), isAbroad() in HTTeamPlayer class

    HTPlayer::getNextBirthDay() now returns xml value, it's no more calculated

    Remove deprecated functions: CHPPConnection::initLive() and HTLineupPlayer::getRatingStarsAtEndOfGame()
  • Download PHT v1.8

    v1.8 06-01-2009

    Add new events : 55 to 59 and 73
  • Download PHT v1.7.1

    v1.7.1 22-12-2008

    Fix matches number managment in live feature
    Fix events 62,68,185,501,502

    New events: 97,186,285,286,335,350,351,352,360,361,362,500,550

    Deprecated initLive() function. Start live by using getLive() function
  • Download PHT v1.7

    v1.7 27-11-2008

    New HTException class, extends Exception, thrown when error occurs
    New event infos, based on Lobster xml/xsd files. You can get named datas for all known events
    A lot of class added, HTEvent and one HTEvent* for each event
    HTLiveMatchEvent class updated with new functions to handle this new feature

    Fix CHPPConnection::checkInitLive() and CHPPConnection::initLive() functions
    Fix CHPPConnection::getAllianceMembersByLetter()

    Remove deprecated functions: CHPPConnection::getAlliancesById() and HTFlags::getLeagueOfFlag()
  • Download PHT v1.6.4

    v1.6.4 21-10-2008

    Fix HTPlayerEvents::getEvent
    Fix HTPlayer::isSkillsAvailable

    Enhance xml error checking
  • Download PHT v1.6.3

    v1.6.3 16-10-2008

    Fix error handling. In case of error, two exceptions can be thrown with one of these messages :
    - Invalid XML: <following by datas received>
    - Error: <following by datas received>
    Fix disconnect() function, remove cookies file
  • Download PHT v1.6.2

    v1.6.2 15-10-2008

    Fix all functions which check an attribute with 'true' value
  • Download PHT v1.6.1

    v1.6.1 10-10-2008

    Fix creation of cookies file when user agent contains invalid characters for filename
  • Download PHT v1.6

    v1.6 08-10-2008

    Fix functions which use Index and Count attributes, these attributes have been removed in new xml files

    Enhance getFlags*() functions :
    - For home and away matches flags : You can call then with a date to get only flags from this date to now.
    - For all flags functions : You can also get a flag by country name in addition of getting it by number

    New : PHT is compatible when safe mode is enabled
    New public functions (instead of being private) : HTTeam::isLeagueLevelAvailable(), HTTeam::isFriendlyAvailable()

    Deprecated (Deprecated functions will be removed within two versions!) :
    - HTFlags::getLeagueOfFlag() is deprecated, use HTFlags::getLeagueOfFlagByNumber() instead
    - CHPPConnection::getAlliancesById(), use CHPPConnection::getAlliances() instead
  • Download PHT v1.5

    v1.5 13-09-2008

    New isTrainer(), getTrainerType(), getTrainerSkill(), getNextBirthDay() functions in HTPlayer and HTTeamPlayer classes
    New getTotalStars() and getTotalStarsAtEndOfMatch() in HTLineup class

    Fix getNumberTransfers() in HTPlayerTransferHistory class
  • Download PHT v1.4

    v1.4 08-09-2008

    Fix some notice error in phperror.log
    Fix internal way to manage xml data in order to work with session
    Fix base cost of specialists
    Fix functions which return boolean
    Fix getEventsNumber() function in HTPlayerEvents class
    Fix getTeam() function in HTLeague class
    Fix minor bugs

    New functions in HTPlayer class: getAgreeability(), getAggressiveness(), getHonesty()
    New parameter for getPrice() function in HTTransfer class, you can specify a currency

    Remove old function getMaketValue() on a player transfer as data is not and was not in xml
  • Download PHT v1.3.1

    v1.3.1 07-09-2008

    Rename clearMatchDetail() into clearSeniorMatchDetail() as it affects cache of senior detail match
    Rename clearMatchesDetails() into clearSeniorMatchesDetails() as it affects cache of senior details matches
    Fix getEvent() function in HTMatch class in order to get all events of a match even if eventID are not consecutive
  • Download PHT v1.3

    v1.3 20-08-2008

    Use new .net files
    New parameter to getRegion() function in order to get data for a particular region
    New getLeagueById(), getLeagueByName(), getLeagueByCountryId() functions in HTWorldDetails class
    New getFlagsHome(), getFlagsAway() functions, with HTFlags class
    New getFlagsHome(), getFlagsAway(), getFlagsPlayers(), getFlagsRaisedPlayers() functions in CHPPConnection class
    New isMatchADerby() function in CHPPConnection class
    New getWorldCupMatches() in CHPPConnection class, new classes class to manage datas
    New getAMatchesList() and getU20MatchesList() function in CHPPConnection class, new classes class to manage datas
    New search features using new .net interface

    Fix HTTeamPlayers and HTTeamOldPlayers class
    Fix getNumberPlayers() function in HTTeamPlayers class
    Fix minor bugs

    No more asp page used, all query are done on .net pages
  • Download PHT v1.2

    v1.2 16-08-2008

    Optimize xml parsing
    Use new .net files
    Use version 1.3 of match lineup
    Use version 1.7 of team players
    Use version 1.3 of player details
    New file supported : achievements : use getAchievements() function to fetch datas, new classes to manage datas.
    New useStageAtYourOwnRisk() function to use stage server to test new features
    New getPositionChange() function in league details
    New parameter isYouth in getMatchOrders() function
    New function getTeamOldPlayers() : returns old players who played in club, new classes to manage datas.
    New function getTeamOldCoaches() : returns old players became coach in another club, new classes to manage datas.
    New getAlliancesById() function
    New getPageIndex() and getPageNumber() functions in HTAlliances class
    New isPlayingMatch() function in HTNationalTeamDetail class
    New getNationalPlayersStats() and getNationalPlayersStatsWorldCup() functions, new classes HTNationalPlayersStats and HTNationalPlayerStats
    New getFirstName(), getLastName(), getNickName() functions in HTTeamPlayer and HTPlayer class, getName() functions are still available in both classes and returns full name of player
    New getLoginResult() function which return login result code

    Fix notice in phperror.log
    Fix syntax bugs
    Fix getRoof() functions
    Fix matchsdetails version in order to fetch formation data
    Fix players fetching data according xml changes
    Fix getTransfer() and getPlayer() functions : work as others similar functions, expected parameter starts from 1 to max
    Fix cup data in team file according to new changes
    Fix getShirtNumber() according to new change
    Fix match lineup when player is not selected
    Fix search arena by name
    Fix getYouthTeamArchiveMatches() function
    Fix clearPlayersEvents() function
    Fix getTeamByLocalName() function
    Fix getNationalPlayers() function
    Fix getArena() function according to new change
    Fix getAllianceDetails() function according to new changes
    Fix all getAlliancesBy*() functions
    Fix all functions which return boolean

    Rename getRatingStarsAtEndOfGame() into getRatingStarsAtEndOfMatch() function in match lineup

    Remove languageID in getPlayerEvents() function
    Remove getTrainerName() in HTTeam class
    Remove endDate parameter in getTeamTransfersHistory() function, replace it by pageIndex according to new change
    Remove getAlliances() and getAlliancesByLang() functions according to new changes
    Remove getCreatedDate() in HTTrainingStats according to new changes
  • Download PHT v1.1

    v1.1 10-06-2008

    Add new RatingStarsEndOfGame value for all players in matchlineup
  • Download PHT v1.0

    v1.0 18-05-2008

    First public version
 

Comments (Post yours)

  • By Samurai-BR the 20-05-2008

    Really very nice job.
    I will try here and when possible return on feedback.
    Congrats, on advance.
    [=
  • By destor77 the 23-05-2008

    excelente trabajo, espero mas ejemplos (sessiones, estadisticas, etc) para poder migrar mi aplicacion a esta herramienta.
    excellent work, I hope more examples (Session, statistics, etc.) to migrate my application to this tool.
  • By Peaso the 26-05-2008

    Very good job. I’ll try it to make my web using PHT.
    Thank you!
  • By destor77 the 26-05-2008

    excelent!!!!!
  • By arash the 24-06-2009

    hi
  • By portugal10 the 07-02-2010

    isto e muito fixe
  • By OR the 12-03-2010

    Hi,
    Is it possible to use this to find out how many minutes a player played in a match?
    Thanks,
    OR
  • By teles the 12-03-2010 teles Hattrick team

    Yes it’s possible. You have to parse matchs events, check if an event is a susbtitution event, then you got the minute and the player of this event.
    Look at HTMatch and HTEvent classes.
  • By david the 17-04-2010

    Thanks a lot, but could you say me what is ‘chppName’, ‘chppId’, ‘chppKey’
  • By teles the 17-04-2010 teles Hattrick team

    It’s your chpp application credentials given by Hattrick. If you don’t have one, as new chpp licence is closed right now, you can’t use PHT
  • By Adriano Moutinho the 08-11-2010

    Thank you very much for this amazing job.

    I found some minor mistakes on the code examples. missing and missing ; on line 21 of second example.

    Anyway, thanks for the development!
  • By teles the 08-11-2010 teles Hattrick team

    Thanks, examples are fixed :)
  • By HiseaSaw the 15-11-2010 HiseaSaw Hattrick team

    Thanks for sharing such a great work.

    Are these examples up-to-date?
    After login in HT I'm getting this error: oauth_problem=parameter_rejected&oauth_problem_advice=When%20obtaining%20a%20request%20token%2C%20you%20must%20not%20supply%20the%20oauth_token%20parameter
  • By teles the 15-11-2010 teles Hattrick team

    Yes examples are up to date.
    Error you got is strange, can you send me your piece of code?
  • By HiseaSaw the 15-11-2010 HiseaSaw Hattrick team

    I'm just using the first "Connection" example, no more code added (except of, obviously, consumer key, consumer secret and the request token url).

    I'm getting the error just after typing my credentials at Hattrick page (https://chpp.hattrick.org/oauth/authorize.aspx?oauth_token=[TOKEN]).

    Thank you again.
  • By HiseaSaw the 15-11-2010 HiseaSaw Hattrick team

    I fixed it, CallBackUrl was wrong ;-)
  • By teles the 15-11-2010 teles Hattrick team

    Of course you need a valid callback :p
    Nice it works for you :)
  • By fcheitenried the 16-11-2010

    Nice Tutorial....

    The Authorization works. But how is the code for an automatically login. I always get this error:
    oauth_problem=token_rejected&oauth_problem_advice=Supply%20a%20correct%20token

    When i get the autorization ther ist an token in the url and an security token. But how goes the automaticaly login.

    pls help

    thx a lot.
  • By teles the 16-11-2010 teles Hattrick team

    When you get the access token and the access token secret you can save it in your user's profile.
    Next time the user comes, you can set back this tokens to PHT and request xml.

    It's the third piece of code of this page: http://pht.htloto.org/documentation/connection.html
    In this example, tokens are set in $userToken and $userTokenSecret
  • By fcheitenried the 17-11-2010

    i got a webpage where i got a download-link (Code of the first step). when i click on it i can login via CHPP-Url. Then i get the token and tokenSecret via URL in my CALLBACK-URL.

    But now i want a "directly" link. I got the Tokens from last login.
    When i only put the code of the 3rd part it does not work.

    thx for ur help.
  • By teles the 17-11-2010 teles Hattrick team

    If you already got an access token, you don't need to redirect user to chpp login page.
    You just request xml files with these tokens set in PHT
    There is no direct link to authenticate user if you have his access token, access is already granted. (if token was not revoke by user on hattrick website)

    If it's doesn't help you, I didn't understood your problem, so you will have to explain it differently :)
  • By Orbix the 21-11-2010

    Hi,

    There is an error in function getHatStats() :

    return ($this->getMidfieldRating()

    instead of

    return ($this->getMiedfieldRating()

    Besides, when I call this line $match->getFirstHalfTime()

    I have this error : Undefined class constant 'SERVER_URL' (line 10245)

    thanks
  • By teles the 21-11-2010 teles Hattrick team

    Yes, 2 errors :(
    Will be fixed in next version, I do my best to publish it tomorrow
  • By teles the 22-11-2010 teles Hattrick team

    Errors are fixed in version 2.2, feel free to upgrade!
  • By alessandro the 24-11-2010 alessandro Hattrick team

    Hi teles, i ve some problem to understand how can i invoke the trainingdate function in my php script, could you help me please?
    Tanks
    Alessandro
  • By teles the 24-11-2010 teles Hattrick team

    I assume you talk about getTrainingDate() in HTWorldLeague class, then you can do it like this:

    $HT->getWorldDetails()->getLeagueById(5)->getTrainingDate();

    with "5" the id of the league you want

    You can also get it by requesting with getLeagueByCountryId() and a country id, or getLeagueByName() with an english name, getLeague() with a number according number of leagues returned in xml (get number with getTotalLeague())
  • By alessandro the 24-11-2010

    Perfect
    i was arrived at this (poor poor english) reading the hattrick api documentation but i get the wrong way using getleaguebyid('4'), but i saw in your PHT.php the class HTWorldLeague it's not possible use this?
    If is possible to contact you i'll be very happy.
    Thanks
  • By teles the 26-11-2010 teles Hattrick team

    I'm not sure I have understood you :) To use getTrainingDate() function you have to use HTWorldDetails class as I said before. Or what is your question?
  • By alessandro the 26-11-2010

    Yes i understand an i'm using $HT->getWorldDetails()->getLeagueById(5)->getTrainingDate();
    like u said, but i found in the your lib file (PHT.php) the class HTWorldLeague that seems to have trainingdate function .
    Alessandro
  • By alessandro the 02-12-2010

    HI teles

    it's me again, i'm upgrade to last versione and i'm trying
    to use getLastMatch() function in this way:

    $HT = $_SESSION['HT']
    $player = $HT->getPlayer('296383769')
    echo $player->getLastMatch()


    but i receive a fatal error
    Call to a member function hasChildNodes() on a non-object in PHT.php on line 9478

    Thanks
    Alessandro
  • By teles the 02-12-2010 teles Hattrick team

    getLastMatch() return an object, no bug this time ;)
  • By Riccardo the 22-12-2010

    Great! It's what I was looking for!!
  • By alessandro the 20-01-2011

    Hi teles my work is on test, but i put a link to your site cause i'm using your framework:
    http://www.modalitaprovvisoria.it/triplete/information.php

    Thanks a lot
    Alessandro
  • By teles the 22-01-2011 teles Hattrick team

    When it's done give me a logo, and I'll add your site on the homepage ;)
  • By alessandro the 24-01-2011

    Hi Teles here my site Banner:

    http://www.modalitaprovvisoria.it/triplete/banner.gif

    Thanks
    Alessandro
  • By alessandro1977 the 30-01-2011

    Hi teles is possibile to retrieve the matches played by my next opponent? i think to use $HT->getSeniorTeamArchiveMatches ()

    but i can't get my opponent ID

    Thank
    Alessandro1977
  • By Alessandro1977 the 30-01-2011

    Ok i retrieve opponent ID, now where i call $HT->getSeniorTeamArchiveMatches () how coul retrieve all match id ?

    Thank
    Alessandro
  • By teles the 05-02-2011 teles Hattrick team

    Hi
    You can do it like this:
    for($i=1; $i<=$list->getMatchNumber(); $i++)
    {
    $list->getMatch($i)->getId();
    //get others match info here
    }
  • By mogito the 15-02-2011 mogito Hattrick team

    Hello Teles,

    J'ai une petite erreur sur ma page de callback :

    "Fatal error: main() [function.main]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "CHPPConnection" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in mypage.php on line 20"

    Une idée ?
  • By mogito the 15-02-2011

    C'est oki, j'ai trouvé l'erreur :p
  • By teles the 19-02-2011 teles Hattrick team

    Désolé pour la réponse tardive, tu as trouvé la solution, tant mieux, mais je vais la donner, ça peut servir à d'autres :)

    Le fichier PHT.php doit être inclus avant de récupérer l'objet en session, car si l'objet n'est pas connu par l'interpréteur avant qu'il soit chargé de la session, il ne peut pas être chargé correctement, d'où l'erreur :)
  • By me9mill the 28-02-2011 me9mill Hattrick team

    Thanks for creating PHT. :)
  • By Saxbar the 15-03-2011

    Bonsoir,
    Je ne comprends pas pourquoi le script suivant (inclu dans une class avec des fonctions) ne retourne rien... même pas une erreur...
    $this->HT = $_SESSION['HT'];
    $this->arenamystats = $this->HT->getMyArenaStats();
    $arenamystats->matchesnumber = $this->arenamystats->getMatchesNumber();

    J'ai essayé de placer des arguments dans getMyArenaStats(); comme la syntaxe le permet mais rien...

    Merci du coup de main ;)
  • By teles the 17-03-2011 teles Hattrick team

    Il y a un bug dans les stats du stats (en fait, il y a eu un changement du côté Hattrick (la doc montre un reste de ce qui est utilisé par PHT et qui ne fonctionne plus)), il va donc falloir attendre la prochaine version de PHT qui va corriger tout ça :)
    Merci pour la remontée !
  • By Saxbar the 18-03-2011

    De rien, j'ai remarqué une coquille dans l'orthographe de la variable weather, c'est peut être lié ?
    mixed $tomorrowWheaterId = null (line 5612)
  • By teles the 19-03-2011 teles Hattrick team

    Non, ce n'est pas lié, et le fait que le nom soit mal orthograpghié ne gêne pas :) Il se trouve que c'est une erreur dans la doc hattrick qui a entrainé une erreur dans pht, ça sera donc corrigé en 2.6
  • By Saxbar the 21-03-2011

    Bonjour Telesphore, j'espère que tu ne m'en voudras pas.
    HTRegion::getName() retourne l'ID de région. Le soucis se situe ligne 5639 ;) j'ai corrigé chez moi mais je te le dis pour la 2.6

    J'en profite pour te dire merci car ton boulot est formidable pour nous qui nous appuyons totalement dessus.
  • By teles the 23-03-2011 teles Hattrick team

    Effectivement, petite erreur :) Sera corrigé en2.6, merci !
  • By chew the 05-04-2011

    Hello, when I try to execute the first piece of code, it return an $url string without the oauth_token --->

    https://chpp.hattrick.org/oauth/authorize.aspx?oauth_token=

    So it gives me error.. I have put consumerkey and consumersecret correctly..Why is there this problem? :(
  • By teles the 06-04-2011 teles Hattrick team

    Can you set you error login to E_ALL and see if something generates an error?
  • By chew the 06-04-2011

    Hello teles and thanks for your answer.. I have set E_ALL..but it doesn't give me errors.. so I have tryied locally and it gives me the oauth_token correctly in the url...So I had a doubt..
    And I have discovered that the problem was that curl that hasn't the support for https.. So I have tryied in a hosting with curl and support https and it works!

    Thanks for all :)
  • By chew the 07-04-2011

    teles I have another question..and I promise that after this I'll disappear :)
    I see the third piece of code for connection and it's ok.. but i think that to save and reuse data, I have to link them to the user id..
    But How can I recover the user id of the user connected in hattrick? Is there a (chpp)link to recover this info or some function in PHT? Or is use of cookies needed?

    Thanks :)
  • By teles the 07-04-2011 teles Hattrick team

    To get userid: getClub()->getUserId()
    But, if you have no self auth system you won't be able to reuse the token (you have to know which user is the visitor, and without own authentication you can't know visitors then reuse token on future visits. You can use cookie but it's not a safe way)
    And you can come when you want, don't leave :)
  • By chew the 07-04-2011

    Thanks for hospitality teles.. and I want to congratulate you for your work... :)

    So have I to create a login on my site...? I thought that there was a way to take parameters of the connection/session of the user to the site of hattrick.. (I have seen some external site that shows status of the user on hattrick..if he's connected or not to hattrick.. but I don't know if it works..)
  • By Mark the 08-04-2011

    PHP Notice: Undefined variable: oauth_token in /srv/http/roba/psiutil/lib/PHT/PHT.php on line 193
    PHP Notice: Undefined variable: oauth_token_secret in /srv/http/roba/psiutil/lib/PHT/PHT.php on line 194

    why?
  • By teles the 08-04-2011 teles Hattrick team

    @chew: no, you don't need to have your own authentication, but in this case, each time a user come to your site he has to login to hattrick and you get a new oauth token. It's not a problem at all, but you don't use a token for more than one session, and at start it's not the goal of oauth, but there is no problem :)

    @Mark: Does oauth process works? After which function call do you get this notices?
  • By Mark the 09-04-2011

    I try to connect and get request token, but it's empty.
  • By chew the 09-04-2011

    @teles Thanks for answers teles :)

    @Mark: I don't know if your problem is similar to my old problem .. (read my message of 06-04-2011.. maybe is that the problem.. ) :)
  • By Mark the 09-04-2011

    @chew, yes It's the same problem.
    I try the script in a php-cli, how can I solve?
  • By Saxbar the 09-04-2011

    Salut Teles,
    Je viens de tomber là dessus (PHT 2.6) :
    Fatal error: Call to a member function getAttribute() on a non-object in /class/PHT.php on line 13320
    Si cela provient bien de la PHT, merci de me donner la correction car ca me bloque.
    Merci d'avance
    Saxbar
  • By Saxbar the 09-04-2011

    Re Salut Teles,
    Si tu pouvais regarder la fonction get433Experience(),
    je pense qu'il y a une coquille dans le code (343 au lieu de 433), elle ne retourne rien.
    Merci ;)
    Saxbar
  • By teles the 10-04-2011 teles Hattrick team

    Oui, bug sur get433Experience() et pour l'autre il doit aussi y avoir un bug, mais je n'arrive pas à avoir l'xml de la page en question, j'ai toujours un timeout :/ Dès que je trouve je publie une version de correction !
  • By Saxbar the 11-04-2011

    Cool,
    encore merci :)
  • By Saxbar the 19-04-2011

    Salut Thelesphore,
    Pour la 2.8, class HTLeagueTeam, getPositionChange(), coquilles sur les lignes 7298 à 7302.
    @+ Christophe
  • By Saxbar the 19-04-2011

    Re.
    Je ne comprends pas, getPositionChange() ne retourne rien.
  • By teles the 20-04-2011 teles Hattrick team

    Remplace la ligne 7284 par ça:
    $this->hasPostionChange = $this->getXml()->getElementsByTagName('PositionChange')->length > 0;
  • By Saxbar the 21-04-2011

    J'ai remplacé la ligne. La fonction isPositionChangeAvailable() retournait deja 1 de toute façon...
  • By Saxbar the 21-04-2011

    Cela ne fonctionne toujours pas. Mystère....
  • By Saxbar the 22-04-2011

    Cela fonctionne avec un autre profil hattrick que le mien, l'incident est clos. Merci bien !
  • By teles the 22-04-2011 teles Hattrick team

    Bizarre ça...
  • By Saxbar the 22-04-2011

    Pour ton info, maintenant, mon isPositionAvailable est à zéro, donc cela explique pourquoi je n'avais rien auparavant. Le pb venait donc bien de la ligne que tu as modifié. (pour ces réglages, ne pourrait-on pas échanger simplement par mail ? Je trouve ce formulaire un peu fastidieux à mon goût. Bref, sinon je pars en vacances, @ très bientôt !)
  • By teles the 22-04-2011 teles Hattrick team

    PHT a un forum sur Hattrick, tu peux aussi poser tes questions là bas ;)
    http://www.hattrick.org/Forum/Overview.aspx?v=0&f=765917
  • By Reelax the 07-05-2011

    Hello,

    Can someone tell me how to perform a connection to HT for our OWN team ? So if we already know our login and our secret password, what code should we use ?

    I mean if I want to create a website presenting my own team.

    Thanks
  • By teles the 07-05-2011 teles Hattrick team

    It's not allowed to develop a CHPP product for personnal needs. You should develop something to be used by the community
  • By eraser the 10-05-2011

    I've created a token from the webpage by using the oAuth test tool, but when trying the code from the last black box, i get "access is denied ..." error.

    How could i use the code from the last box? Where do i get the right token?

    Thanks
  • By teles the 11-05-2011 teles Hattrick team

    What do you mean for "last black box" ?
  • By josh the 17-05-2011

    hey there,
    maybe a noob question but where do i get those consumerKey and consumerSecret?

    Must i request them in hattrick via registering an app or how do i get this?

    Would be very pleasant if somebody can help a beginner :*-/
  • By teles the 17-05-2011 teles Hattrick team

    Hi, Yes, to get consumerKey and consumerSecret to use OAuth system you have to request and obtain a chpp lience for a product. First, accept developper licence agreement http://www.hattrick.org/Community/CHPP/ChppBecomingDeveloper.aspx , then ask a licence: http://www.hattrick.org/Community/CHPP/ChppApplyToCreateProgram.aspx
  • By Marius_J the 20-05-2011

    Hi teles! I am trying to connect CHPP to my web site - I'm developing a CHPP tool and I have the comsumer key and secret from OAuth. But, where do I put in this codes above? And what is the callbackurl? :)

    Thank you for answering! :)
  • By teles the 21-05-2011 teles Hattrick team

    You have to pass consumer data to CHPPConnection() function.
    The callback url is the url where the user will be redirected after login on Hattrick website, it must be an url on your site in which you will receive data for getting OAuth token.
  • By WouterT the 21-05-2011

    Hi Teles,
    Thanks for this great program, but I've got a question; is it also possible to just save the xml generated by hattrick on my webserver and do imports from that file?
    1. I've got a backup then.
    2. I can use data from those files for "stuff" I add later on.
    Thanks,
    Wouter
  • By Marius_J the 21-05-2011

    Thank you for quick answer :)

    I am using the website tool "Joomla!" to build my website. U am a beginner with this, and I don't understand how I request token ect.

    The codes above in the black boxes, where do I put them?

    Thank you,
    Marius_J
  • By teles the 21-05-2011 teles Hattrick team

    I don't know Joomla, so I can't help that much on it.
    You have to put this code somewhere in page, or module, ... which will do the chpp connection for your site.
  • By Marius_J the 22-05-2011

    I don't understand the discription on how to request token etc. or what I have to replace in the codes above...

    Could you please help me with a little description?

    Thank you,
    Marius_J
  • By teles the 25-05-2011 teles Hattrick team

    You have to get a "request token", then user has to authenticate on hattrick website, and when user returns to your site you have to get a "access token", this token is a valid token to get xml files.
  • By leroutard the 28-06-2011

    Hello,
    I want to know if we can get all team from a leagueId ( poule en français) ?
    If yes, which class handle this ? ( I can't find it )

    Thanks

  • By teles the 28-06-2011 teles Hattrick team

    No, there is no easy way to get all teams from a specific league.
    You can search league with search xml file, yu got leagueUnitId, then with league xml file you can find team of this league.
  • By leroutard the 28-06-2011

    Ok , thanks for the quick answer !
  • By mrbrown79 the 26-07-2011

    Hi Teles,

    Great tool.

    Do you have an overview of the memory usage of PHT?

    In the code skeleton below, I try to get the player data from a large amount of leagues. At some point, I get a memory exhausted error. So my theory is that the memory usage accumulates for each TeamPlayers lookup.

    Any comments on this theory?

    $HT = new CHPPConnection('mSoqGeWBwLGPPCCKHLDwwT', 'xx','xx'');
    $HT->setOauthToken($userToken);
    $HT->setOauthTokenSecret($userTokenSecret);

    for($leagueId=$firstLeague;$leagueIdgetLeague($leagueId);

    for($i=1; $igetTeam($i);
    $leagueTeamId = $leagueTeam->getTeamId();
    $players = $HT->getTeamPlayers($leagueTeamId);
    for($j=1; $jgetNumberPlayers(); $j++)
    {
    $player = $players->getPlayer($j);
    $name = addslashes($player->getName());
    $age = $player->getAge();
    $salary = $player->getSalary() ;
    $stamina = $player->getStamina();
    $tsi = $player->getTsi() ;
    $exp = $player->getExperience() ;
    $id = $player->getId() ;
    sql_insert(); // defined elsewhere
    }
    }
    }
  • By mrbrown79 the 26-07-2011

    Hmm. My last post was corrupted to some degree apparantly due to close-to-html tags.

    Anyway, the code is three nested for loops.

    1st running through leagues
    2nd running through teams (of each league)
    3rd running through players (of each team)

    All is done on the same CHPPConnection.

    Do you think, the memory usage of each player lookup will accumulate in such a case?
  • By teles the 26-07-2011 teles Hattrick team

    Yes of course :) After each loop, clear PHT cache according to what you called, you will decrease memory used
  • By mrbrown79 the 27-07-2011

    OK. I'm not experienced into object-oriented PHP programming. Can you exemplify how I could clear the cache? Is it just to re-instantiate the CHPPConnection?

    As the process of data collection is pretty time-consuming, I want it to be (close to) optimal with reference to processing time. Please, let me know if you have any tricks in regards to this :)
  • By teles the 27-07-2011 teles Hattrick team

    After the for loop for getTeamPlayers()
    you can call $HT->clearTeamPlayers($leagueTeamId);

    When you call getTeam($id), after you get all you want you can call clearTeam($id)

    It will clear pht cache (there is a cache on each xml file) and then you will consume less memory
  • By halftime the 10-08-2011

    "Notice: Trying to get property of non-object in
    ../trunk/PHT.php on line 13477"

    function: $player->getRatingStarsAtEndOfMatch();
  • By guillermo the 22-10-2011

    hi teles, this looks rly nice!

    I have a nab doubt, when u say that we can save user token u mean on acutal session or in a db?

    if its on db, when the user puts login i can manage the conecction to his team without doing 1st step?

    i dont rly undertand steps. 1st one i give my chpp credentials and a url for users, they log in on hattrick and i get a request with their oauth_token and oauth_verifier.
    retrieveAccessToken method is to validate that ? and after that i can store that access data in a db?
  • By teles the 26-10-2011 teles Hattrick team

    Hi,
    Yes, retrieveAccessToken is to validate the token and give you real access to user data.
    When you got the final token, you can save it to reuse later and avoid firsts login steps.
  • By Thomas the 16-11-2011

    Got the following error:

    Fatal error: Call to undefined method HTTeam::getNumberFlagsHome()

    I used the above example...
  • By Hoedinie the 22-11-2011 Hoedinie Hattrick team

    Can anyone help me on how to get the userToken and userTokensecret. I am trying to store it in a local xml file so the administrative tasks can use my own account.
  • By teles the 08-01-2012 teles Hattrick team

    Thomas, you have to use getTeamFlags() function in order to have a HTTeamFlags object and not a HTTeam object
  • By teles the 08-01-2012 teles Hattrick team

    Hoedinie, have you read this doc: http://pht.htloto.org/documentation/connection.html
    When you retrieve the token in last step, you can save it on your side, as you want, and reuse it without doing whole auth process.
  • By Mark the 13-01-2012

    I can get the season and the current week? If yes, which is the method that can do this?
  • By teles the 20-01-2012 teles Hattrick team

    You can get current season with getLeagueSeason() function if you don't provide second parameter.
    There is no easy way to get current week, you have to test if week match is played or not.
  • By fcheitenried the 06-03-2012

    Nice Tutorial... One thing i still need..... How can i fetch the LeagueData...
    Want to have the whole table... how to do this...

  • By teles the 12-03-2012 teles Hattrick team

    With getLeague() you can get league info, then browse 8 teams and get score
  • By fcheitenried the 22-03-2012

    Didn't work.. maybe im too stupid.....
    i tried with:
    $HT->getLeague()->getLeagueTeam('1')->getPoints();
    also tried with:
    $HT->getLeague()->getLeagueTeam()->getTeam('1')->getPoints();


    i wantet to have the points of the Team at first position. Do i am completly Wrong.

    pls help
  • By teles the 12-04-2012 teles Hattrick team

    Sorry for the delay of my answer
    You have to do: $HT->getLeague()->getTeam(1)->getPoints();

Add your comment