^
matches start-of-string not start-of-line. Use the m
("multi-line") modifier: //m
You have to add the m
modifier:
preg_match_all('|^<A HREF="(?<url>.*?)"><strong>Next</strong>|m', $html, $url_matches);
then ^
matches at start of a line, else it would only match at the start of the entire string.
More Info: http://php.net/manual/en/reference.pcre.pattern.modifiers.php