Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
titleDisable peer verification example
require_once("tornevall_network.php");
$CURL = new \TorneLIB\Tornevall_cURL();
$CURL->setSslUnverified(true);
$output = $CURL->doGet("https://my-test-url.com");

Parsing regular HTML

The library has, as of 5.0.0-20120211, the ability to convert regular incoming html-documents into a parsed array, if there is a need to read any content as an array. Since this ability may consume memory and/or CPU, it has to be enabled first. It has been tested with HTML documents, so far and it extracts a document by following content:

  • ByNodes
    Extracted in the simplest way, by nodes, meaning every each of the elements are sorted out with information about the elements tagnames and attributes (name and id)
  • ByClosestTag
    Extracts the DOMDocument and sets its closest element identification to each of the array variables, beginning with the tagname→element name → element id.
  • ById
    Extracts the DOMDocument and sets the element identification by its id (getElementById equivalent) 

 

Code Block
languagephp
titleHTML Content Parsing
require_once("tornevall_network.php");
$CURL = new \TorneLIB\Tornevall_cURL();
$CURL->setParseHtml(true);
$output = $CURL->doGet("https://my-test-url.com");
var_dump($output['parsed']['ById']);