I’ve been hammering a (govermental website that handles companies in Sweden) , to get information about companies in Sweden to get output from the form-data there but I cant manage to do this.
Website = https://foretagsfakta.bolagsverket.se/fpl-dft-ext-web/home.seam?cid=42326
I have put togheter this code but i cant seem to get the variables right in form. I understand that you need to use the fp-sok and select the radiobutton with fp-sok:type:0 and submit searchterm with fp-sok:sokterm but I have ran out of guessing combinations. Any guidance and it would be nice to get to know what I am doing wrong.
The current code on where Im at:
`
$url = “https://foretagsfakta.bolagsverket.se/fpl-dft-ext-web/home.seam?cid=42326”
$Fields = @{‘fp-sok’ = ‘fp-sok:type:0’;‘fp-sok:sokterm’ = ‘556762-6782’,‘fp-sok:find’}
$Bolagsverket = (Invoke-WebRequest $url -SessionVariable ‘jsessionid=mHfhj5tCYVxTNMO9-q2AjKaV.JVM30-dh2-prod-jas36’ -Method Post -Body $Fields)
$Bolagsverket
`
But I am only getting this, which is a kinda /ignore answer from the website;
`
StatusCode : 200
StatusDescription : OK
Content :
<meta http-equiv="Cont...
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8
Date: Fri, 16 Oct 2015 12:22:27 GMT
Set-Cookie: JSESSIONID=n7ZRxzSsEIrmgJXIB74NVrC9.JVM30-dh2-prod-jas36; Path=/fpl…
Forms : {fp-sok}
Headers : {[Transfer-Encoding, chunked], [Content-Type, text/html;charset=UTF-8], [Date, Fri, 16 Oct 2015 12:22:27 GMT], [Set-Cookie, JSESSIONID=n7ZRxzSsEIrmgJ
XIB74NVrC9.JVM30-dh2-prod-jas36; Path=/fpl-dft-ext-web; Secure]…}
Images : {@{innerHTML=; innerText=; outerHTML=; outerText=; tagNam
e=IMG; alt=Bolagsverket; src=https://www.bolagsverket.se/bilder/logo.gif; width=200; height=33}, @{innerHTML=; innerText=; outerHTML=; outerText=; tagName=IMG; alt=Kundvagn ; src=img/kundvagn.png}}
InputFields : {@{innerHTML=; innerText=; outerHTML=; outerText=; tagName=INPUT; type=hidden; value=fp-sok; name=fp-sok}
, @{innerHTML=; innerText=; outerHTML=; outerText=; tagName=INPUT; id=fp-sok:type
:0; CHECKED=; type=radio; value=1; name=fp-sok:type}, @{innerHTML=; innerText=; outerHTML=; outerText=; tagName=INPUT; id=fp-sok:type:1; type=radio; value=2; name=fp-sok:type}, @{innerHTML=; innerText=; outerHTML=; outerText=; tagName=INPUT; id=fp-sok:sokterm; maxLength=100; name=fp-sok:sokterm}…}
Links : {@{innerHTML=; innerText=; outerHTML=
; outerText=; tagName=A; title=Till Bolagsverkets webbplats; href=http://www.bolagsverket.se}, @{innerHTML=In English; innerText=In English; outerHT
ML=In English; outerText=In English; tagName=A; lang=en; id=menuId1; href=/fpl-dft-ext-web/home.seam;jsessioni
d=n7ZRxzSsEIrmgJXIB74NVrC9.JVM30-dh2-prod-jas36?sprak=en&actionMethod=home.xhtml%3Alanguage.bytSprak&cid=31478}, @{innerHTML=navigering; inne
rText=navigering; outerHTML=navigering; outerText=navigering; tagName=A; accessKey=s; href=#omradesnav}, @{inne
rHTML=Logga in; innerText=Logga in; outerHTML=Logga in; outerText=Logga in; tagName=A; id=j_id102; href=/fpl-dft-ext-web/login.seam;jsessionid=n7ZRxzSsEIrmgJXIB74NVrC9.JVM30-dh2-
prod-jas36?cid=31478}…}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 8286
`
When analyzing the form on the website by making the request manually using the browser, and with using the software Fiddler as the analyzer-tool and looking at the forms-tab, I’m getting these values. But I still cannot grasp how I need to handle this request;
`
Name: Value:
test
fp-sok:type 1
fp-sok:sokterm 556762-6782
fp-sok fp-sok
javax.faces.ViewState j_id11
fp-sok:find Search
`
Please anyone, help
Thanks guys!