Search through website source code using fopen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fidelity
    New Member
    • Apr 2010
    • 1

    #1

    Search through website source code using fopen

    Hi!

    I want to search for the following string through the source code of website 'mywebsite.com' with fopen; http://sub.example.com/example.php?id= **random id** but do not want to include let's say http://sub2.example.co m?id=**random id**.

    Example:

    Code:
    $openurl = fopen('http://www.mywebsite.com', "r");
    while(! feof($openurl))
      {
    //Which code do I need to use here?
      }
    The source code of the website mywebsite.com has simple HTML coding and contains several links in one line. These links defer from this:
    <img src="http://sub.example.com/example.php?id= 12345">

    to this:
    <img src="http://sub2.example.co m/00123/?id=12345">

    What code should I use to find these strings in the above mentioned example coding?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    The PCRE extension to PHP would be useful here. Check out the tutorials and learn some regular expressions.

    Mark.

    Comment

    Working...