Web Requests
You can compare the code of the simple demonstration below with web requests in Oxygene for Java and Smart Pascal.
program HTTPRequestDemo; {$mode objfpc}{$H+} uses sfmlNetwork, sfmlSystem; var request: TsfmlHttpRequest; response: TsfmlHttpResponse; http: TSfmlHttp; begin request := TsfmlHttpRequest.Create; request.setMethod(sfHttpPost); request.setUri('/static/pp4s/resources/RunPenApplet.html'); http := TSfmlHttp.Create; http.SetHost('http://www.pp4s.co.uk/', 80); response := http.sendRequest(request, sfmlSeconds(1)); if response.GetStatus = sfHttpOk then writeln(response.GetBody); readln; end.
Output:
<html> <head> <title>Pen Applet</title> </head> <body> <center> <h3>Pen Applet</h2> <p>Java must be enabled.</p> <applet archive="pen.jar" code="pen_applet/PenApplet.class" width="200" height="200" /> </center> </body> </html>