Posts

Showing posts with the label PHP

Find the biggest text on the page.

After googling for a while i found some methods using PHP's Document Object Model (DOM) but none of them  works correctly. In my opinion , the best and most reliable way to determine the biggest text on the web page is : $TEXT1=array(); $TEXT=html_entity_decode(strip_tags($NewsHTML)); $TEXT=explode("\n",$TEXT); foreach ($TEXT as $k=>$v){ unset($TEXT[$k]);$TEXT1[strlen($v)]=trim($v); } $TEXT=$TEXT1; ksort($TEXT); $TEXT=(end($TEXT));

Ultimate parser for the web.

Ever looking for universal parser ? Tired of writing regular expressions that may not work ! Dreaming about SQL syntax while parsing the web ? DomSQL ( Document Object Model Structured Query Language ) is a Language that realy makes web smaller :) Imagine that you can use from your php or javascript app query like this : SELECT page1.{body[0]/.class=classname[0]} as page1element1 page2.{body[0]/.id=someId[0]} as page2element1, NOW() as now FROM {http://somepage1.net} as page1 JOIN {http://somepage2.net/subdir} as page2 ON (page1.{body[0]/.id=someotherId[0]}=page2.{body[0]/.class=someotherClass[2]}) WHERE LOWER(CAST(wt.{body[0]/.class=twc-module-tab-content[0]} AS CHAR)) LIKE '%searchWord%' order by page1.datetime desc limit 1 To search two pages with similar elements with some word . now it is realy possible .... take a look at this project DomSQL , if you are a web developer , you will like it ( just like i did ;) )