Thanks for your suggestions.[quote=274440:@Michel Bujardet]Christian has plugins to get the HTML code within an HTMLViewer. Then you clean it up of the HTML code and you are fine.[/quote]
Cleaning it up is not a problem, but it is a pity to have to install a pluging just to read something that Xojo must know since it was able to write it on the HTMLViewer.
There is a method “LoadPage” but unfortunately there is no method to get the shown code, something like “SavePage”. That is something we usually do in the browser by right-clicking on the page.
Try Ashot’s suggestion. Some sites will not respond to requests that do not include a User Agent, probably to help thwart robots.
[quote=274423:@Jeff Tullin]If you access this through the browser, it executes the PHP script.
If you use an httpsocket, it tries to download the php file itself.
[/quote]
Jeff, that’s not how PHP works. PHP scripts are executed on the server side, not the client side. With a properly-working server, you can never access the contents of a PHP file directly.
Youre definitely missing some header stuff as others have suggested. Its either the missing user agent or the script is being limited to an http 1.1 request and the regular HTTP socket still makes an http1.0 request. The full set of headers when I connect to something with safari that are sent is:
GET /something/else/yes HTTP/1.1
Host: 192.168.0.10:20301
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17
Accept-Language: en-us
DNT: 1
Connection: keep-alive
You can add the user agent to it with the SetRequestHeader before you make the request like:
http.SetRequestHeader(“User-Agent:”, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17)
If that still doesnt work then it might be the http 1.0 vs 1.1 problem in which case you will have to use the new framework to make the request. which should work on most targets now I think:
Its very similar but sends a 1.1 request. You can also roll your own easily enough as long as you dont need to support any of the drastically more complicated encodings or something. Just to get data back isnt that hard with a raw socket and sending that list of headers.