I want to have a text box where a user would type in the URL to a website or specific page... Then upon pressing submit the script would find all links on that page, including image links and echo them all in a list...
I think this has got something to do with fopen() to open up the webpage as a file and then fclose() to close it again... Not sure though
Any ideas?
Thanks
Comments
Let's break down what we need to do first of all:
1. Read all data from the file - Simply read the data from the file and place it into a variable in our PHP script.
2. Search for all possible link tags - We will need to use preg in order to perform a process of identifying all the possible link tags in a page. Link tags can be broken down and identified by A and IMG.
3. Store link tags into an array.
4. Loop through the array and output the links.
Okay so now what we can do is create our own class that can be used to manipulate data on a page. I have decided to show a class here for you as you can enhance it with many more file-handling functions yourself.
Here is the class with an explanation of each part.
Edit: Removed. I need to fix a few things for you. Sorry. Can't do them right now though.
Take a look at the section on using remote files.
Webmaster-Talk.com
Chroder.com
Yep I forgot about that. I was getting confused with something else. :P
Sorry man I keep forgetting to do this. Perhaps you would be quicker to research yourself instead of waiting for me. What you need to do is learn about regular expressions. Simply do a search on google for "regular expressions PHP" and you should be able to find what you need.