I have this script:
$URI = "http://www.trlibor.org/fixingrates.asp"
$HTML = Invoke-WebRequest -Uri $URI
$1MRate = $HTML.ParsedHtml.getElementsByTagName("td")[11].InnerText
$1MRate = $1MRate.replace(',','.')
$1MRate
$2MRate = $HTML.ParsedHtml.getElementsByTagName("td")[15].InnerText
$2MRate= $2MRate.replace(',','.')
$2MRate
$3MRate = $HTML.ParsedHtml.getElementsByTagName("td")[19].InnerText
$3MRate= $3MRate.replace(',','.')
$3MRate
$6MRate = $HTML.ParsedHtml.getElementsByTagName("td")[23].InnerText
$6MRate= $6MRate.replace(',','.')
$6MRate
$9MRate = $HTML.ParsedHtml.getElementsByTagName("td")[27].InnerText
$9MRate= $9MRate.replace(',','.')
$9MRate
$1YRate = $HTML.ParsedHtml.getElementsByTagName("td")[31].InnerText
$1YRate= $1YRate.replace(',','.')
$1YRate
It's working TOTALLY fine on my machine, but when I run it on a Windows Server R12, the variables $1MRate...$2MRate are not getting values (null) as if the td elements do not exist on that page.
any idea why is that?
$HTML("This site can’t be reached"?)Write-Host $HTML.contentto confirm that this is what you expect (= the same on your local machine).