i write php programe for finde .mp3 link from a web site rss
try{
$con = new SimpleXMLElement('http://www.taktarane.ir/feed',NULL,TRUE);
foreach ($con->channel->item as $items) {
$content = $items->children('content', true)->encoded;
$newReg = "/(http)(s?)(\:\/\/)(www\.)(.{5,120})(\.)(mp3|zip)/i";
preg_match_all($newReg, $content, $matches, null, 0);
print_r($matches);
}
}catch (Exception $ex){
echo $ex;
}
However, it return empty array!!! Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( )
However i test in http://regex101.com/ it has 35 match result !!
Simply leave the 2 last parameters. The parameter flags must not be null, but either PREG_PATTERN_ORDER or PREG_SET_ORDER
preg_match_all($newReg, $content, $matches);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.