Page 2 of 2

Re: Homework question

Posted: Friday 27th January 2023 1:56pm
by BruceSteers
twbro54l wrote: Friday 27th January 2023 1:29pm Thank you so much! Yes, I'm new to Gambas. I'm going to add the born-date, month and current-date (or the date they want the data for) in a Form and print it in a text area.
Ill post updates when I'm done. Thank you guys so much!
Well welcome to the wonderful world of gambas basic.

Have a good read of the wiki, especially the String pages i gave the links to.
With commands like Instr() and Mid() you can find and extract any data you need.

Re: Homework question

Posted: Friday 27th January 2023 3:59pm
by cogier
This was a bit of fun.

Here is a good start to your program: -

Image
Test-0.0.1.tar.gz
(12.88 KiB) Downloaded 229 times

Re: Homework question

Posted: Monday 12th February 2024 6:29am
by divineapi632
Public Sub Form_Open()

Dim hClient As HttpClient 'To create a HTTP Client
Dim sResult As String 'To store the word's meaning

hClient = New HttpClient As "hClient" 'Create a HTTP Client
With hClient 'With the Client..
.URL = "https://divineapi.com/" 'Set up the URL
.Async = False 'No Asynchronous transmission?
.TimeOut = 60 'Don't hang around waiting for more than 60 seconds
.get 'Get the data
End With

While Lof(hClient) ' Lof has a value until all the file has been downloaded

sResult = hClient.ReadLine() ' Read 1 single line

If sResult Like "<meta property=\"og:description\" content=*" Then ' Here the line is found
sResult = Mid(sResult, InStr(sResult, "content=") + 9) ' trim out the left side
sResult = Mid(sResult, 1, RInStr(sResult, "\"") - 1) ' trim out the right side
hClient.Close ' close the stream
Break ' exit the loop
Endif
Wend

Print sResult

End

Re: Homework question

Posted: Monday 12th February 2024 7:46am
by DigitalDivineapi
twbro54l wrote: Thursday 26th January 2023 4:51pm Im trying to build a horoscope app for school which reads the data from an URL. The question is: How can I read contents of a URL page and get only the data I want? Like the string I want is after "<meta property="og:description" content=xxxxxxxxxxx"" .
I'm not interested in being spoon feed but I really need some help!
Thanks :P
While I can offer you guidance on how to achieve your goal, another option to consider is utilizing the services of Divine API[https://divineapi.com/], which provides robust functionalities for retrieving specific data from URLs, such as extracting the content you're interested in, like horoscope information. Divine API offers easy integration and comprehensive documentation to streamline your development process. It could be a valuable tool for your horoscope app project.