httpGetURI()

Returns the last from the Client (index) requested URI from the HTTP server.

Synopsis

string httpGetURI(intidx);

Parameter

Parameter Description
idx Delivers the connection number idx from the server to the current client.

Return value

Returns a URI as a string.

Description

Returns the last from the Client (index) requested URI (Uniform Resource Identifier URI) from the HTTP server. A common type of a URI is the URL (Uniform Resource Locator) in other words a web address.

Example

#uses "CtrlHTTP"
main()
{
    httpServer(FALSE, 12000,0); // Installiert den HTTP-Server
    httpConnect("work", "/english");
    httpConnect("work", "/deutsch");
}
string work(dyn_string names, dyn_string values, string user, string ip, dyn_string headerNames, dyn_string headerValues, int idx)
{
    string sURI = httpGetURI(idx);
    if (sURI == "/english")  // Client hat http://host/english angefragt
    {
        return "<html><head><title>English Example</title></head>" "<body>This
        is an HTML-example</body></html>";
    }
    if (sURI == "/deutsch")  // Client hat http://host/deutsch angefragt
    {
       return "<html><head><title>Deutsches Beispiel</title></head>""<body>Dies ist ein HTML-Beispiel</body></html>";
    }
}

Assignment

CTRL PlugIn

Availability

CTRL