How to find specific query in the URL and display whole link
Current code is like this :
include 'simple_html_dom.php';
    // Create DOM from URL or file
    $html = file_get_html('http://www.AnyLinkAlsoCan.com');
    // Find all links
    foreach($html->find('a') as $element)
           echo $element->href . '<br>';
It will crawl and find tag like this :
<a href="http://news.example.com/node">
And will output all link it found on the website.
Example
http://news.example.com.my/node/321072
http://news.example.com.my/taxonomy/term/2
http://news.example.com.my/node/321060?tid=2
I want to search url that contain only ?tid= as you can see on the 3rd URL
in the example.
http://news.example.com.my/node/321060?tid=2
I replace echo $element->href="*?tid but that just return error. Can
someone help me with this?
 
No comments:
Post a Comment