20.11.2010, 00:50
SA-MP OpenAPI
What is OpenAPI?OpenAPI is a class based http query mechanism for utilization by SA-MP's http native. The class was created as a small project of mine that I thought would be highly useful for server owners whom don't have access to a host to upload there own API for use with there scripts.
Using OpenAPI
When using OpenAPI you supply your information to the system by means of using the $_GET system. Simply specify the parameters within the URL and the system will handle the rest.
1ST URL ParameterAPI URL: openapi.x-host.co.uk/public_query.php?
This parameter is the crucial one that determines what function you are wishing to utilize. This parameter has 3 types as listed below.2ND URL Parameter
Example of first parameter: openapi.x-host.co.uk/public_query.php?func=TYPE_IPHANDLE
- TYPE_ENCRYPTION - This is the string encryption module.
- TYPE_EMAILING - This is the client emailing module.
- TYPE_IPHANDLE - This is the IP handling module.
This parameter is based upon the first parameter that you specified in the URL first. For example if you used the function type TYPE_ENCRYPTION before only a set amount of functions will work for that module.3RD URL Parameter
TYPE_ENCRYPTIONTYPE_EMAILING
- ENCRYPT_MD5 - Returns the given string in MD5.
- ENCRYPT_BASE64 - Returns the given string in Base64.
- DECRYPT_BASE64 - Returns the given Base64 string in plain text.
TYPE_IPHANDLE
- EMAIL_CLIENT - Returns a boolean based upon the success of emailing the specified client.
Example of second parameter: openapi.x-host.co.uk/public_query.php?func=TYPE_ENCRYPTION&method=ENCRY PT_MD5
- IP_HOSTNAME - Returns the given IP addresses hostname in plain text.
This parameter consists of the function parameters of the function you want to utilize. This can have a maximum of three parameters.
ENCRYPT_MD5ENCRYPT_BASE64
- string - This is the string you want to hash to MD5.
- Example: openapi.x-host.co.uk/public_query.php?func=TYPE_ENCRYPTION&method=ENCRY PT_MD5&string=Hello
DECRYPT_BASE64
- string - This is the string you want to encode to Base64.
- Example: openapi.x-host.co.uk/public_query.php?func=TYPE_ENCRYPTION&method=ENCRY PT_BASE64&string=Hello
EMAIL_CLIENT
- string - This is the string you want to decode to plan text from Base64.
- Example: openapi.x-host.co.uk/public_query.php?func=TYPE_ENCRYPTION&method=DECRY PT_BASE64&string=SGVsbG8=
IP_HOSTNAME
- email_addr - This is the email address you wish to email.
- email_subject - This is the subject of the email you wish to send.
- email_message - This is the message you with to send.
- Example: openapi.x-host.co.uk/public_query.php?func=TYPE_EMAILING&method=EMAIL_C LIENT&email_addr=example@example.com&email_subject =Hello&email_message=How are you doing there.
- ip_addr - This is the IP address that you with to obtain the hostname for.
- Example: openapi.x-host.co.uk/public_query.php?func=TYPE_IPHANDLE&method=IP_HOST NAME&ip_addr=173.194.36.104