How to fetch the iframe source URL from HTML content using PHP

We will use the preg_match_all function in PHP for this task. This function takes the html content and the regular expression pattern to test as input and returns an array with the matches. If the function does not find any matches then it returns FALSE. The function we have coded is just echoing the iframe source URL found in the variable passed. $html is the variable passed to the function in our example.

preg_match_all('/<\/iframe>/s', $html, $arrReturn, PREG_SET_ORDER);	
for($j=0; $j";
}  
Please follow and like us:
error

Be the first to comment

Leave a Reply

Your email address will not be published.