I wanna replace all date with a space from the fetched content using SIMPLE HTML PHP DOM PARSER (simplehtmldom.sourceforge.net). Here is the code:
include("simple_html_php_dom.php");
$html = file_get_html("http://freebacklinks.prijm.com"); //example.com
$result = "$html";
$result = preg_replace("/([1-9]|[0-2][0-9]|3[0-1]) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4}/", " ", $result);
$result = preg_replace("/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([1-9]|[0-2][0-9]|3[0-1]) [0-9]{4}/", " ", $result);
echo $result;
So, here all date data like: 01 Jan 2004 or Jan 01 2004 or Dec 12 14 should be replaced by a space… But its not replacing those date with space.. Now what to do?
Here is a example showing how it will work.. http://codepad.org/lAuHW565 but why its not working in PHP Simple HTML DOM Parser
You’re trying to replace on a
SimpleHTMLobject which is impossible (it’s an object, not a string). What you should do is first get the HTML, then replace, and then turn it intoSimpleHTMLusing thestr_get_htmlfunction.