SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP code to Get Internal and External Link from a webpage

    Hello,


    How we can get Internal and External Link from a webpage in php.

  2. #2
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you explain more clearly what you actually need?

  3. #3
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Thanks for your response.

    I need how many internal and external link are present in a website's home page.

    I am accutally trying to design spider simulator tool in php.

  4. #4
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, to get the webpage contents, you will have to use libcurl, Snoopy or another HTTP client library.

    Then use a reg exp to fetch all the URLs from the page and check, which start with a protocol:// or www. prefix, compare them with the website URL, and if they are different, they can be considered external.

    Also, the method can vary depending on whether you want subdomain.website.com to be cosidered as external.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •