xpath dom php code

DOMDocument PHP Tutorial

DOMDocument function is used to parse and manipulate HTML and XML documents in PHP. Below are a few examples on how to use the DOMDocument php function.

Install PHP XML Dom Parser

On Ubuntu

On Redhat/CentOS


Instantiate DOMDocument and Parse HTML


Parse meta description

Meta Description: 


Parse meta keywords

Meta Keywords: 


Parse h1 tag text

h1:  Cron Job at 7 am Everyday and Other Crontab Examples


Parse h2 tag text

h2:   Examples Post navigation


Parse h3 and h4 tag text

h3:   List out Cron Jobs for Current User Edit Cron Jobs for Current User Crontab Column Meanings Everyday at 7 am Everyday at 9:30 am Everyday at 9:30 am, Monday Through Friday 1st Day of the Month at 12:30 am Every Tuesday at Midnight Every Tuesday at Midnight Every 2 Minutes Leave a Reply Cancel reply Latest Posts Bitbook


Parse all text except inside script tags

Leave a Reply

Your email address will not be published. Required fields are marked *