\Request.php
RouterOS API client implementation.
This package allows you to read and write information from a RouterOS host using MikroTik's RouterOS API.
PHP version 5
- Author
- Vasil Rangelov
- Category
- Net
- Copyright
- 2011 Vasil Rangelov
- License
- LGPL License 2.1
- Link
- http://netrouteros.sourceforge.net/
- Package
- PEAR2_Net_RouterOS
- Version
- 1.0.0b1
\PEAR2\Net\RouterOS\Request
Represents a RouterOS request.
- Parent(s)
- \PEAR2\Net\RouterOS\Message
- Author
- Vasil Rangelov
- Category
- Net
- License
- LGPL License 2.1
- Link
- http://netrouteros.sourceforge.net/
Properties


array
$arguments= 'array('
Methods


__construct(
string $command
)
:
void
Creates a request to send to RouterOS.
Name | Type | Description |
---|---|---|
$command | string | The command to send. |
- See
- \PEAR2\Net\RouterOS\setCommand()
- See
- \PEAR2\Net\RouterOS\setArgument()
- See
- \PEAR2\Net\RouterOS\setTag()


getAllArguments(
)
:
array
Gets all arguments in an array.
Inherited from: \PEAR2\Net\RouterOS\Message::getAllArguments()Type | Description |
---|---|
array | An array with the keys as argument names, and the array values as argument values. |
- See
- \PEAR2\Net\RouterOS\getArgument()
- See
- \PEAR2\Net\RouterOS\setArgument()


getArgument(
string $name
)
:
string|resource
Name | Type | Description |
---|---|---|
$name | string | The name of the argument. |
Type | Description |
---|---|
string|resource | The value of the specified argument. Returns NULL if such an argument is not set. |
- See
- \PEAR2\Net\RouterOS\setArgument()


getCommand(
)
:
string
Gets the command that will be send to RouterOS.
Gets the command that will be send to RouterOS in its API syntax.
Type | Description |
---|---|
string | The command to send. |
- See
- \PEAR2\Net\RouterOS\setCommand()


getQuery(
)
:
\PEAR2\Net\RouterOS\Query
Gets the currently associated query
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Query | The currently associated query. |
- See
- \PEAR2\Net\RouterOS\setQuery()


getTag(
)
:
string
Gets the tag that the message is associated with.
Inherited from: \PEAR2\Net\RouterOS\Message::getTag()Type | Description |
---|---|
string | The current tag or NULL if there isn't a tag. |
- See
- \PEAR2\Net\RouterOS\setTag()


removeAllArguments(
)
:
\PEAR2\Net\RouterOS\Request
Removes all arguments from the request.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | The request object. |


sanitizeArgumentName(
mixed $name
)
:
string
Sanitizes a name of an argument (message or query one).
Inherited from: \PEAR2\Net\RouterOS\Message::sanitizeArgumentName()Name | Type | Description |
---|---|---|
$name | mixed | The name to sanitize. |
Type | Description |
---|---|
string | The sanitized name. |


sanitizeArgumentValue(
mixed $value
)
:
string
Sanitizes a value of an argument (message or query one).
Inherited from: \PEAR2\Net\RouterOS\Message::sanitizeArgumentValue()Name | Type | Description |
---|---|---|
$value | mixed | The value to sanitize. |
Type | Description |
---|---|
string | The sanitized value. |


send(
\PEAR2\Net\RouterOS\Communicator $com
)
:
int
Sends a request over a communicator.
Name | Type | Description |
---|---|---|
$com | \PEAR2\Net\RouterOS\Communicator | The communicator to send the request over. |
Type | Description |
---|---|
int | The number of bytes sent. |


setArgument(
string $name, string $value
=
null
)
:
\PEAR2\Net\RouterOS\Request
Sets an argument for the request.
Name | Type | Description |
---|---|---|
$name | string | Name of the argument. |
$value | string | Value of the argument. Setting the value to NULL removes an argument of this name. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | The request object. |
- See
- \PEAR2\Net\RouterOS\getArgument()


setCommand(
string $command
)
:
\PEAR2\Net\RouterOS\Request
Sets the command to send to RouterOS.
Sets the command to send to RouterOS. The command can use the API or CLI syntax of RouterOS, but either way, it must be absolute (begin with a "/") and without arguments.
Name | Type | Description |
---|---|---|
$command | string | The command to send. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | The request object. |
- See
- \PEAR2\Net\RouterOS\getCommand()
- See
- \PEAR2\Net\RouterOS\setArgument()


setQuery(
\PEAR2\Net\RouterOS\Query $query
=
null
)
:
\PEAR2\Net\RouterOS\Request
Sets the query to send with the command.
Name | Type | Description |
---|---|---|
$query | \PEAR2\Net\RouterOS\Query | The query to be set. Setting NULL will remove the currently associated query. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | The request object. |
- See
- \PEAR2\Net\RouterOS\getQuery()


setTag(
string $tag
)
:
\PEAR2\Net\RouterOS\Request
Sets the tag to associate the request with.
Sets the tag to associate the request with. Setting NULL erases the currently set tag.
Name | Type | Description |
---|---|---|
$tag | string | The tag to set. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | The request object. |
- See
- \PEAR2\Net\RouterOS\getTag()