View Single Post
Old 16th September 2019, 16:52     #1
MadMax
Stuff
 
powershell - website scraping

If I run the following:


$nzpost = invoke-webrequest -uri https://nzpost.co.nz/tools/address-p...inder/address/[somenumber]/1 long street highbury palmerston north rd1
($nzpost.inputfields.value -split '\n')[1]


... i get the resolved address including the postcode (assuming a valid address).

If i had a csv file like the following:
address1, address2, city, rural
1 long street, highbury, palmerston north, rd1
1 short road, awapuni, palmerston north, rd1

(eg, $csvfile = import-csv -path 'c:\addresses.csv'

How would i do a scrape for-each of the csv file lines?

[somenumber] seems to be a static random that's re-usable.
__________________
My degree of sarcasm depends on your degree of stupidity.

Last edited by MadMax : 16th September 2019 at 16:57.
  Reply With Quote