| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/store.tiacyrusxxx.com/public_html/whale/QueryPath/examples/ |
Upload File : |
<?php
/**
* Basic example of QueryPath usage.
*
* This two-line example exhibits basic use of QueryPath. It creates a new
* HTML document and adds the typical 'Hello World' text to the body. It then writes
* that information to standard out (which is flushed to a web browser in most cases.)
*
* The important methods covered here are {@link qp()}, which is the {@link QueryPath}
* factory function, {@link QueryPath::find()}, which is the primary searching
* function, and {@link QueryPath::writeHTML()}, which is a utility function.
*
* This file is fully explained in the official QueryPath tutorial, located
* at {@link https://fedorahosted.org/querypath/wiki/QueryPathTutorial}
*
*
* @author M Butcher <matt@aleph-null.tv>
* @license LGPL The GNU Lesser GPL (LGPL) or an MIT-like license.
* @see qp()
* @see QueryPath::find()
* @see QueryPath::writeHTML()
* @see html.php
* @see https://fedorahosted.org/querypath/wiki/QueryPathTutorial The Official Tutorial
*/
require_once '../src/QueryPath/QueryPath.php';
qp(QueryPath::HTML_STUB)->find('body')->text('Hello World')->writeHTML();
$qp = htmlqp(QueryPath::HTML_STUB, 'body');
$qp->append('<div></div><p id="cool">Hello</p><p id="notcool">Goodbye</p>')
->children('p')
->after('<p id="new">new paragraph</p>');
echo ($qp->find('p')->children('p')->html()) ? 'print' : 'dont print';;
// ->writeHTML();