Libreoffice Calc Basic get WebPage page data

The code below is a Microsoft Excel VBA code. What’s the LibreOffice Calc Basic equivalent of Set request = CreateObject("MSXML2.XMLHTTP") ? I am running LibreOffice 5.1 in Ubuntu 14.04.

Sub testGet
    Dim request As Object
    Dim response As String
    Dim URL As String

    Set request = CreateObject("MSXML2.XMLHTTP")
    URL = "http://github.com/trending"

    With request
        .Open "GET", URL, False
        .send
        response = .responseText
    End With
End Sub

With EasyDev, is easy: http://easydev.readthedocs.io/en/latest/requests.html

Sub Main
    util = createUnoService("org.universolibre.EasyDev")
    data = createUnoStruct("org.universolibre.EasyDev.Requests")

    data.Method = "get"
    data.Url = "http://github.com/trending"
    response = util.requests(data)
    
	util.fileSave("/home/USER/info.txt", "w", response.Text)

	MsgBox "End"
End Sub

Best regards

This requires that the user installs EasyDev first right? I was wondering if there was any way that didn’t required installing additional software.

of course, not that I know

I developed EasyDev, because Basic is very poor

Best regards

You could insert a data link to get the web page data into a worksheet.

' Location for the data from the web page.
oAddress = oSheet.getCellByPosition( 0, 0 ).getCellAddress()

' The HTML sections are named HTML_all, HTML_tables, HTML_1, HTML_2, HTML_3, etc.
oDoc.AreaLinks.insertAtPosition( oAddress, url, "HTML_tables", "calc_HTML_WebQuery", "0 0" )

' Following breaks the link, but leaves the data
oDoc.AreaLinks.removeByIndex( 0 )

I don’t see how this code could fetch any data. I have no problem processing html, I just have problem getting everything as text from a URL in the first place.

If you try it you will see the text from the web page is added to the worksheet, then you can search the worksheet for the data you want.

You see the format from GUI using “Sheet”, “Link to External Data …”, then enter the URL, and select the part of the HTML required.

Break the link or change settings from “Edit”, “Links…”.