Jump to content

How to get and display all the website links from a website in PHP?


Recommended Posts

I tried searching on google but couldn't find any relevant information, please redirect me to relevant source or help me with the code.

 

I want to pass a domain name in text field which will be scanned and then the script will display entire site map.

 

Not external links or links on a page. Sorry it is not easy for me to explain.

 

Eg. if i pass abc.com

 

Script will display

 

abc.com/12/adn.php

abc.com/asd/asd/

etc

 

Whatever their url format is.

 

All the links on that domain.

Your going to need to use Screen Scraping (google "PHP screen scraping") and some regular expressions (which should be included in a screen scraping tutorial). There are a lot of tutorials out there on screen scraping.

But how will screen scraping give all the links associated with that domain name on that website?

 

I searched on google but every article talks about fetching a part of the content on a web page from the website.

 

I think i need to do something like a xml site map generator where it crawls website and displays all the links.

 

Any tutorial for that?

Sorry. I thought you wanted to grab the links from the pages themselves. If you want to do a site search for links, there is probably a way to do a customized search from google, but I don't know how, exactly. Anybody else here know?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.