Hi, I'm trying to parse the data connection left from my sim operator
I've been trying to log through webclient but unsuccesfully cause there are two cookies which i m not able to reproduce during login
This is what I'm getting inspecting the network during login
A POST
Request URL: https://www.iliad.it/account/
Request Method: POST
Status Code: 302
Remote Address: 83.158.240.200:443
Referrer Policy: strict-origin-when-cross-origin
cache-control: no-store, no-cache, must-revalidate
content-security-policy: default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' *.iliad.it *.beta.iliad.it osm.proxad.net acsbapp.com *.acsbapp.com
content-type: text/html; charset=UTF-8
date: Sat, 24 Dec 2022 02:27:40 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
location: /account/
pragma: no-cache
server: nginx
:authority: www.iliad.it
:method: POST
:path: /account/
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7
cache-control: max-age=0
content-length: 43
content-type: application/x-www-form-urlencoded
cookie: ACCOUNT_SESSID=n0e687i06be1413dhrp3jbg742; _pk_id.1.903b=56a498eaa01287fe.1648071494.; _pk_id.7.903b=b873b5f1c8f474e8.1664023672.; _pk_ses.7.903b=1; _pk_ses.1.903b=1
origin: https://www.iliad.it
referer: https://www.iliad.it/account/
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: same-origin
sec-fetch-user: ?1
sec-gpc: 1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
and on PAYLOAD
login-ident: my username
login-pwd: my password
the url code is /login-ident=myusername&login-pwd=mypassword
and a GET
Request URL: https://www.iliad.it/account/
Request Method: GET
Status Code: 200
Remote Address: 83.158.240.200:443
Referrer Policy: strict-origin-when-cross-origin
cache-control: no-store, no-cache, must-revalidate
content-encoding: gzip
content-security-policy: default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' *.iliad.it *.beta.iliad.it osm.proxad.net acsbapp.com *.acsbapp.com
content-type: text/html; charset=utf-8
date: Sat, 24 Dec 2022 02:27:40 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
server: nginx
:authority: www.iliad.it
:method: GET
:path: /account/
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7
cache-control: max-age=0
cookie: ACCOUNT_SESSID=n0e687i06be1413dhrp3jbg742; _pk_id.1.903b=56a498eaa01287fe.1648071494.; _pk_id.7.903b=b873b5f1c8f474e8.1664023672.; _pk_ses.7.903b=1; _pk_ses.1.903b=1
referer: https://www.iliad.it/account/
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: same-origin
sec-fetch-user: ?1
sec-gpc: 1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
Both have the same cookies
After I log into it, I would like to parse the data connection left, which is inside of some identical divs
<div class="conso-infos conso-local">
<div class="grid-l conso__grid">
<div class="grid-c w-4 w-tablet-4">
<div class="conso__content">
<div class="conso__text">
Chiamate: <span class="red">18h 9m 21s</span><br>
Consumi voce: <span class="red">0.00€</span>
</div>
<div class="conso__icon" data-target="voix">
<div class="wrapper-align">
<div class="i-call icon"></div>
Chiamate
</div>
</div>
</div>
</div>
<div class="grid-c w-4 w-tablet-4">
<div class="conso__content">
<div class="conso__text"><span class="red">5 SMS</span><br>
SMS extra: <span class="red">0.00€</span>
</div>
<div class="conso__icon" data-target="sms">
<div class="wrapper-align">
<div class="i-message icon"></div>
SMS
</div>
</div>
</div>
</div>
</div>
<div class="grid-l conso__grid">
<div class="grid-c w-4 w-tablet-4">
<div class="conso__content">
<div class="conso__text">
<span class="red">93,43GB</span> / 160GB<br>
Consumi Dati: <span class="red">0.00€</span>
</div>
where 93,43GB is what I want to parse.
I've tried using the webbrowser control, succeeding with the login but having issues parsing the data connection left (93,43GB).
I've tried with
Dim parsing As HtmlElementCollection
parsing = WebBrowser1.Document.GetElementsByTagName("div class")
For Each gb As HtmlElement In parsing
Dim connection As String = gb.GetAttribute("span class").ToString
If gb.GetAttribute("span class").ToString Then
gb.Children(2).OuterText
End If
Next
but getting the error
Property access must assign to the property or use its value.
on the line gb.Children(2).OuterText
I've been trying that because as you can see the data connection left is inside identical previous divs, so the following code won't return that specifying value
sourceString = WebBrowser1.Document.Body.InnerHtml
Label1.Text = ""
Dim allinputtext As String = sourceString
Dim textafter As String = "</span> / 160GB<br>"
Dim textbefore As String = "<span class=""red"">"
Dim startPosition As Integer = allinputtext.IndexOf(textbefore)
'If text before was not found, return Nothing
If startPosition < 0 Then
End If
'Move the start position to the end of the text before, rather than the beginning.
startPosition += textbefore.Length
'Find the first occurrence of text after the desired number
Dim endPosition As Integer = allinputtext.IndexOf(textafter, startPosition)
'If text after was not found, return Nothing
If endPosition < 0 Then
End If
'Get the string found at the start and end positions
Dim textFound As String = allinputtext.Substring(startPosition, endPosition - startPosition)
TextBox1.Text = (textFound)
Let's say that both solutions are really rough, so I'm trying to use a webclient...
Any help is apprecciated..
Much Thanks and Good Holiday everyone