preg match all - php preg_match_all words starting with? -
i'm pulling in calendar external site file_get_contents, can use jquery .load on it.
in order fix relative path issues approach, i'm using preg_match_all.
so doing
preg_match_all("/<a href='([^\"]*)'/iu", $string, $match);
gets me occurrences of <a href = '' i'm after links inside single quotes. each link starts "?date" have <a href='?date=4%2f9%2f2014&a' etc.
how can efficiently string between single quotes in <a href= occurrences.
use dom parser href <a> tag
<?php $file = "your.html"; $doc = new domdocument(); $doc->loadhtmlfile($file); $elements = $doc->getelementsbytagname('a'); foreach ($elements $tag) { echo $tag->getattribute('href'); }
Comments
Post a Comment