Extracting HTML link fragment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • goatboy
    New Member
    • Sep 2009
    • 7

    Extracting HTML link fragment

    I recently decided to start learning Perl. I usually choose something useful for my first project in any language, so I decided to write a script to give information based upon a supplied MAC address.

    Everything in the script works fine, until I try to display the MAC vendor.

    In order to do so, I supply the MAC address as a query to a website which checks it against a database. That website then displays the vendor in the page in the form of a link to a Google search.

    I am able to get the HTML contents just fine, but I need to get the Google search argument. For example, if my MAC address is 00:11:22:33:44: 55, the website will return a link to "http://www.google.com/search?q=CIMSYS Inc"

    I need to be able to extract and display the "CIMSYS Inc" part of that particular link. So far, I have tried several regular expressions to no avail. I have messed around with HTML::SimpleLin kExtor, HTML::Parser, and a few others. They seem to be what I need, but for some reason or another I am not using them correctly.

    Can someone give some insight to this? I don't want to be spoonfed, but rather given a push in the right direction from someone who has done this before.

    As always, any (useful) input is appreciated.
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Net::MAC::Vendo r - look up the vendor for a MAC

    Comment

    • goatboy
      New Member
      • Sep 2009
      • 7

      #3
      FML

      It seems every idea I have has already been done and turned into a module of some sort! Well, that's the beauty of code, I suppose.

      However, for the sake of learning, I'm still interested in a way to selectively pull text from a page.

      Comment

      • RonB
        Recognized Expert Contributor
        • Jun 2009
        • 589

        #4
        Have you tried HTML::LinkExtor - Extract links from an HTML document

        Comment

        Working...