PHP: Extraction of tags from html content

Hi guys,

I was trying to achieve the following:

  1. Retrieve content of a website and assign it to a variable:
    $content = file_get_contents(“http://www.somewebsite.com”) or die(“Can’t open URL”);
  1. Detect for all occurances of textbox stored in $content and retrieves it’s ID or Name.

Any suggestions on how this can be done? Thanks in advance.