homesupportsample php client library reference

overview

this sample client library (language binding) can be used to interact with the brafton api in an object oriented manner using php code. the library wraps up sending requests and parsing the xml responses into objects.

compatible with: php5

[jump to top]

download

[jump to top]

example

include_once 'sample_php_apiclientlibrary/apihandler.php'; //reference to sample php client library you downloaded from above.

//feed configuration
$api_key = "your_api_key"; // your unique api_key as provided via email
$apibaseurl = "your_api_base_url"; // your api base url as provided via email
$feed = new apihandler($api_key, $apibaseurl); //create a new feed object
$newslist = $feed->getnewshtml(); //return an array of your latest news items with html encoding text. note this is still raw data.

[jump to top]

apihandler class reference

this is the main class which provides the core methods to interact with your feed and return several collections of objects related to your feed i.e. news items, category definitions and latest comments.

[constructor ]

apihandler($api_key, $apibaseurl)

  • description:apihandler class contructor.
  • parameter – $api_key:your unique api key.
  • parameter – $apibaseurl:the base url provided to you
  • exceptions:xmlloadexception
[news functions ]

getnewshtml()

  • description:get an array of news item objects for the feed with the body content in html format
  • return values:array of newsitem

getnewsraw()

  • description:get an array of news item objects for the feed with the body content in raw text
  • return values:array of newsitem
[category functions ]

getcategorydefinitions()

  • description:return an array of all the category objects defined for the feed
  • return values:array of newscategory
[comment functions ]

getlatestcomments()

  • description:get an array of all the latest comments on news items for the feed
  • return values:array of newscomment

[jump to top]

newsitem class reference

[properties ]
  • getbyline():string – author of the news article
  • getcategories():category[] – array of category objects associated with the news article
  • getclientquote():string – quote text from the client relating to this item.
  • getcomments():comment[] – array of comment objects associated with the news article
  • getcreateddate:string – iso 8601 system autogenerated date when the item was created
  • getencoding():string – character encoding system used eg. utf-8
  • getextract():string – a summary of the news article
  • getformat():string – format of text content either html or raw
  • getheadline():string – the news article headline
  • gethtmlmetadescription():string – value for the description meta tag for the news article
  • gethtmlmetakeywords():string – value for the keywords meta tag for the news article
  • gethtmlmetalanguage():string – value for the language meta tag of the news article
  • gethtmltitle():string – value for the html title element
  • getid():int – primary key. the unique news article id
  • getlastmodifieddate()::string – iso 8601 date article was last modified
  • getphotos():ienumerable
              

    – array of photo objects associated with the news article

  • getpriority():int – priority flag 30 = high, normal = 20 used to prioritise news
  • getpublishdate():string – iso 8601 date article was published
  • getsource():string – original source of the article
  • getstate():string – current state of the article eg live / approval / draft / deleted
  • gettags():string – a comma separated list of free text tags
  • gettext():string – text content of the news article
  • gettweettext():string – special 140 character twitter version of the news article

[jump to top]

newscategory class reference

[properties ]
  • getid():int – the unique category id
  • getname():string – the text name of the category

[jump to top]

photo class reference

[properties ]
  • getalt():string – text which can be used in the alternative text attribute for the image
  • getcustom():photoinstance – get custom photoinstance of the photograph
  • gethires():photoinstance – get high resolution photoinstance of the photograph
  • getid():int – the unique photo id
  • getlarge():photoinstance – get large photoinstance of the photograph
  • getorientation():string – orientation of photo either portrait or landscape
  • getthumb():photoinstance – get thumbnail photoinstance of the photograph

[jump to top]

photoinstance class reference

[properties ]
  • getheight():int – the height in pixels of this instance of the image
  • geturl():string – the url that points to the source location of this instance of the image
  • getwidth():int – the width in pixels of this instance of the image

[jump to top]

newscomment class reference

[properties ]
  • getcommenttxt():string – the comment text
  • getid():int – the unique comment id
  • getlocation():string – geographic location information for the comment
  • getpostdate():string – iso 8601 date when the comment was submitted
  • getuser():string – name of commentor

[jump to top]