Emnico in Swindon and its partners
in the UK and Europe provide:

» IT Support Services and Products
» Bespoke Software Development


Contact our Swindon office on:
+44 (0)1793 614 700
to discuss your IT needs.


CLOSE IT
Emnico Logo
Your Virtual Technology Team
Delivering Peak Performance
Category: Type: Order:
Search For:  
Home > Library > Get Page Title

Get Page Title

This powershell function will retrieve the title text of a specified HTML page.
Added 277 days ago by Emnico
Download
Review
Back
68Views
This script has been successfully tested by Emnico and is verified to be working.

Source code

# Returns the value of the title tag from an html page
# Example usage: Get-Title http://emnico.com

Function Get-Title {
    param([string] $url)
    $wc = New-Object System.Net.WebClient
    $data = $wc.downloadstring($url)
    $title = [regex] '(?<=<title>)([\S\s]*?)(?=</title>)'
    write-output $title.Match($data).value.trim()
}

Get-Title http://emnico.com


| Privacy policy | Environmental policy | Site map |