Hello there, i have one small problem and dont know how to fix it, hope someone can help me with this $Source = $cURL->cURL_Data( $cURL_Array ); $preg_code_1 = "/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/is"; preg_match_all($preg_code_1, $Source, $links_source); $Links_Array = array(); foreach($links_source as $link) { $Links_Array = array( $link[1] => $link[3], ); echo $link[1]; } foreach($Links_Array as $URL => $Title) { echo "Url - " . $URL . "<br />Title - " . $Title . "<br /><br />\n\n"; } PHP: is not show me all the urls from the source ...
Using regular expressions to extract links from a web page is not the way to go. Use DOMDocument().. It should be included with your PHP distribution. Example: <?php $html = $cURL->cURL_Data( $cURL_Array ); $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link) { print $link->getAttribute('href') . "<br>\n"; } ?> PHP: