Hi all
I log in to a site and I need the data on the page that is in the labels and text boxes of the site. Is there a way to take a copy of site data through pb?
For example, after entering the customer's username and password on the site and logging in, I need to save a copy of the displayed data such as phone, address, national code, etc. in pb.
I hope my explanation was complete.
Get data from opened website
Re: Get data from opened website
I haven't really understood what you want to do yet.
If you want to read dynamic data from the DOM, this is probably only possible via Javascript injection. If you want to read the static html, you can read it with GetgadgetText or use httpRequest()
If you want to read dynamic data from the DOM, this is probably only possible via Javascript injection. If you want to read the static html, you can read it with GetgadgetText or use httpRequest()
"Daddy, I'll run faster, then it is not so far..."
-
DarkDragon
- Addict

- Posts: 2347
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Get data from opened website
Using a WebGadget/WebViewGadget or the installed browser outside your application?
If you want to control a browser which is already installed WebDriver is probably the most feasible option.
https://chromedriver.chromium.org/home
https://chromium.googlesource.com/chrom ... _status.md
If you want to control a browser which is already installed WebDriver is probably the most feasible option.
https://chromedriver.chromium.org/home
https://chromium.googlesource.com/chrom ... _status.md
bye,
Daniel
Daniel
Re: Get data from opened website
How can I do this with WebViewGadget?
Re: Get data from opened website
Something like that should work:
Code: Select all
OpenWindow(0, 0, 0, 800, 600, "PureBasic", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
WebGadget(0, 0, 0, 800, 600, "https://www.purebasic.com/french/#loginform")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_StatusChange
Debug GetGadgetItemText(0, #PB_Web_HtmlCode)
EndSelect
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
Re: Get data from opened website
Hello, thank you for your useful codes. Is there a function to search values in HTML tags? This is the most important part of the work.
Re: Get data from opened website
Code: Select all
HTML$ = "sjdfhjsf<hello>123</hello>"
Pos1 = FindString(HTML$, "<hello>")
If Pos1
Pos1 + 7
Pos2 = FindString(HTML$, "<" , Pos1)
If Pos2
Value$ = Mid(HTML$, Pos1, Pos2 - Pos1)
Debug Value$
EndIf
EndIf
Last edited by infratec on Sat Apr 13, 2024 9:46 pm, edited 1 time in total.
Re: Get data from opened website
Or with a regular expression:
Code: Select all
.*<hello>(.*)<\/.*Code: Select all
If CreateRegularExpression(0, ".*<hello>(.*)<\/.*")
If ExamineRegularExpression(0, "sjdfhjsf<hello>123</hello>")
While NextRegularExpressionMatch(0)
Debug RegularExpressionGroup(0, 1)
Wend
EndIf
Else
Debug RegularExpressionError()
EndIf

