This sub-section describes other ways of entering data into a Cliqon system.

Scraping

Cliqon implements "simple_html_dom" script as Htmldom.php. This is one version of the API for these Classes. This is a popular 3rd Party Script which is lodged on Sourceforge and the documentation plus examples for simple_html_dom.php are ubiquitous.


Helper functions:

  • str_get_html ( string $content )   -   Creates a DOM object from a string.
  • file_get_html ( string $filename )   -   Creates a DOM object from a file or a URL.


DOM methods & properties:

  • __construct ( [string $filename] )   -   Constructor, set the filename parameter will automatically load the contents, either text or file/url.
  • plaintext   -   Returns the contents extracted from HTML.
  • clear ()   -   Clean up memory.
  • load ( string $content )   -   Load contents from a string.
  • save ( [string $filename] )   -   Dumps the internal DOM tree back into a string. If the $filename is set, result string will save to file.
  • load_file ( string $filename )   -   Load contents from a from a file or a URL.
  • set_callback ( string $function_name )   -   Set a callback function.
  • find ( string $selector [, int $index] )   -   Find elements by the CSS selector. Returns the Nth element object if index is set, otherwise return an array of object.


Element methods & properties:

  • [attribute]   -   Read or write element's attribure value.
  • tag   -   Read or write the tag name of element.
  • outertext   -   Read or write the outer HTML text of element.
  • innertext   -   Read or write the inner HTML text of element.
  • plaintext   -   Read or write the plain text of element.
  • find ( string $selector [, int $index] )   -   Find children by the CSS selector. Returns the Nth element object if index is set, otherwise, return an array of object.


DOM traversing:

  • $e->children ( [int $index] )   -   Returns the Nth child object if index is set, otherwise return an array of children.
  • $e->parent ()   -   Returns the parent of element.
  • $e->first_child ()   -   Returns the first child of element, or null if not found.
  • $e->last_child ()   -   Returns the last child of element, or null if not found.
  • $e->next_sibling ()   -   Returns the next sibling of element, or null if not found.
  • $e->prev_sibling ()   -   Returns the previous sibling of element, or null if not found.


You can also call methods with W3C STANDARD camel naming convertions.

  • $e->getAllAttributes ()   -   $e->attr
  • $e->getAttribute ( $name )   -   $e->attribute
  • $e->setAttribute ( $name, $value )   -   $value = $e->attribute
  • $e->hasAttribute ( $name )   -   isset($e->attribute)
  • $e->removeAttribute ( $name )   -   $e->attribute = null
  • $e->getElementById ( $id )   -   $e->find ( "#$id", 0 )
  • $e->getElementsById ( $id [,$index] )   -   $e->find ( "#$id" [, int $index] )
  • $e->getElementByTagName ($name )   -   $e->find ( $name, 0 )
  • $e->getElementsByTagName ( $name [, $index] )   -   $e->find ( $name [, int $index] )
  • $e->parentNode ()   -   $e->parent ()
  • $e->childNodes ( [$index] )   -   $e->children ( [int $index] )
  • $e->firstChild ()   -   $e->first_child ()
  • $e->lastChild ()   -   $e->last_child ()
  • $e->nextSibling ()   -   $e->next_sibling ()
  • $e->previousSibling ()   -   $e->prev_sibling ()


API

It is no longer a requirement of interaction with Cliqon on the web server that a Client has to invoke a web browser to make that connection. Examples of the code necessary to utilise the RESTful services that Cliqon can publish are detailed in a number of sections in this documentation, for example, in Configuration -> Access Control.

Created with the Personal Edition of HelpNDoc: Easily create EPub books