By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

Search through website source code using fopen

P: 1
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.com?id=**random id**.

Example:

Expand|Select|Wrap|Line Numbers
  1. $openurl = fopen('http://www.mywebsite.com', "r");
  2. while(! feof($openurl))
  3.   {
  4. //Which code do I need to use here?
  5.   }
  6.  
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.com/00123/?id=12345">

What code should I use to find these strings in the above mentioned example coding?
Apr 3 '10 #1
Share this Question
Share on Google+
1 Reply


Markus
Expert 5K+
P: 6,050
The PCRE extension to PHP would be useful here. Check out the tutorials and learn some regular expressions.

Mark.
Apr 4 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.