Using Invoke-WebRequest to Return upcoming MMA Events

Using Invoke-WebRequest to Return upcoming MMA Events

Use this for easy navigation to main pages. This is hidden on your site
Delete me after reading
Post & Video Instructions - This is hidden on your site
  • Latest Posts & Videos, All Posts, and All Videos are served from the CONTENT DATABASE, based on a few properties:
  • Latest Posts & Videos
    1. Type: Post or Video plus Feature As a Feature post or video, it also serves to the home page as a Latest Post or Latest Video. Consider only having 1-3 Feature at a time to avoid cluttering the page.
    2. Status: Live - a post or video marked as Draft will not serve to this page or the home page.
    All Posts or All Videos
    1. Type: Post or Video
    2. Status: Live
  • Make sure to replace the text in the properties: Title, Excerpt, and Published Date so Post display correctly like this:
  • image

When I began using PowerShell I recall seeing some awesome stuff being done with Invoke-WebRequest. After seeing the output of Invoke-WebRequest I quickly became overwhelmed and moved onto a different task. The output may seem a bit overwhelming at first, but once you know what to look for it starts to become more manageable.


Our goal is to create a function that will query I love watching MMA events, and I rarely miss a UFC event. There are also events by other promotions that I don’t want to miss. Hopefully the function that we create will help me ensure that I’m aware of all upcoming events, without having to leave my favorite console!


Invoke-WebRequest is a command that will send a web request and output the parsed results. Your browser sends web requests and renders the html that is returned. We don’t have the benefit of being able to render html in PowerShell, so we have to be creative.

Sending a Web Request

Invoke-WebRequest -Uri ''

The output contains several properties that have been created for us. These include Statuscode, StatusDescription, Content, RawContent, Forms, Headers, Images, InputFields, and Links. We are interested in the Links property.

Parsing the Web Request

$request = Invoke-WebRequest -Uri '' # view the 1st link $request.links.innertext[1]

LFA 75: Lamson vs. Estr?zulas 00days 10hours 15minutes Sat Sep 7th 9:00:00 PM EDT

It looks like all of the relevant information is there.

Now all that’s left is to parse the text and output an object.

Get-MMAEvent Function


© 2022 AndrewPla.Tech
Take care of yourself because you deserve it