With an Openoffice macro, I want to load data from my local webserver. I tried this code :
Dim stringWeb As String, webAddr As String
Dim doc As Object
Dim opts(0) As New com.sun.star.beans.PropertyValue
webAddr = "http://127.0.0.1:8080"
opts(0).Name = "Hidden"
opts(0).Value = True
doc = StarDesktop.loadComponentFromURL(webAddr, "_blank", 0, opts)
stringWeb = doc.Text.String
doc.close(True)
MsgBox(stringWeb, 0, "Result")
This code works, but how to do when the webserver doesn't listen on port 80 ?? (for example, on port 8080) I tried webAddr = "http://127.0.0.1:8080" but it doesn't work :(
Someone could help me ? Thanks.
Edit: perhaps with this kind of code ?
Dim vParser, vDisp
Dim oUrl As New com.sun.star.util.URL
oUrl.Complete = "http://127.0.0.1:8080"
vParser = createUnoService("com.sun.star.util.URLTransformer")
vParser.parseStrict(oUrl)
vDisp = StarDesktop.queryDispatch(oUrl, "", 0)
If (Not IsNull(vDisp)) Then vDisp.dispatch(oUrl, noargs())
But I don't know how to use it :/
This works:
webAddr = "http://178.33.250.62:8080/" 'portquiz.net
On my machine I do not have a web server running at all, so the following results in an IllegalArgumentException ("Unsupported URL"):
webAddr = "http://127.0.0.1"
It seems, then, that the problem is not related to OpenOffice or Basic. Rather, the problem lies in the way your web server is configured.