Jump to content

Web scraping: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 823:
<pre>
Jul. 24, 01:38:23 AM EDT Eastern Time
</pre>
 
=={{header|Gambas}}==
<lang gambas>Public Sub Main()
Dim sWeb, sTemp, sOutput As String 'Variables
 
Shell "wget -O /tmp/web http://tycho.usno.navy.mil/cgi-bin/timer.pl" Wait 'Use 'wget' to save the web file in /tmp/
 
sWeb = File.Load("/tmp/web") 'Open file and store in sWeb
 
For Each sTemp In Split(sWeb, gb.NewLine) 'Split the file by NewLines..
If InStr(sTemp, "UTC") Then 'If the line contains "UTC" then..
sOutPut = sTemp 'Extract the line into sOutput
Break 'Get out of here
End If
Next
 
Print Mid(sOutput, 5) 'Print the result without the '<BR>' tag
 
End</lang>
Output:
<pre>
Jun. 10, 15:22:25 UTC Universal Time
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.