Skip to content

http

With any HTTP module request, you can pass the no_debug parameter to prevent FC2's console/terminal from showing the outcome. This can be useful for /luar.

get

Type

function

Parameters

  • string url

Returns

  • string

post

Type

function

Parameters

  • string url
  • string data

Returns

  • string

escape

Type

function

Parameters

  • string string

Returns

  • string

to_file

Type

function

Parameters

  • string url
  • string file_name/path

open

Type

function

Description

Opens a URL in your browser.

Parameters

  • string url

new

Type

function

Description

Opens a new FC2 HTTP server. This function is useful if you want to bind the current solution's HTTP methods to an IP address. This will allow you to access the server through other devices on the network. Be wary of port usage as if the port is already being used by the host, this function will fail.

Parameters

  • string host
  • number port

/lua

Type

GET Method

Description

This will run Lua code inside of a specific script. You can leave the script parameter blank. If you do, FC2 will automatically use fc2.lua, which is automatically loaded upon launch. code must be URI encoded.

Read this guide on HTTP <-> Lua intercommunication.

Parameters

  • script script_name
  • code lua_code

/sessions

Type

GET Method

Description

This will return a JSON object of the member's Session data. This will also include the member's raw license key. This is similar to getMember in the Web API.


/configuration

Type

GET Method

Returns

  • json configuration

/configuration

Type

POST Method

Description

This will set the configuration inside of FC2. This will not save it in the cloud network.

Parameters

  • json configuration

/reset

Type

GET Method

Description

Reloads all scripts and the solution.


/directory

Type

GET Method

Description

This will list all files in a directory. If you do not pass path then FC2 will use your current directory.

Parameters

  • path directory path (optional)

/processes

Type

GET Method

Description

Gets a list of all currently running processes.


/ping

Type

GET Method

Returns

  • pong

/achievements

Type

GET Method

Returns

  • json achievement data

/ipc

Type

GET Method

Description

This will automatically install ZombieFC2 or FC2K depending on the protection level of the member.


/shutdown

Type

GET Method

Description

Closes a solution.


/luar

Type

GET Method

Description

This will trigger an alternative version of the on_http_request callback, in which you can return a string. The string value returned is sent back to the client/browser that made the HTTP request. Click me for an example.


/luar

Type

POST Method

Description

This will trigger an alternative version of the on_http_request callback, in which you can return a string. The string value returned is sent back to the client/browser that made the HTTP request. Click me for an example. The difference between this method and GET is that this method contains a body.