Links

File upload request

To upload a file to the server, you need to send POST data containing login, password, file variables. The response will be the id of the saved file, which you can later use in xml-requests.
post
http://lk.mysmpp.ru/xml/file.php
File upload request
Parameters
Body
login*
String
Your login in the system
password*
String
Your password in the system
token*
String
You can use a secret key instead of login and password. To obtain it, please contact your manager
file*
data
File to be sent
Responses
200: OK
In the case of a valid request
400: Bad Request
If an error occurs

File upload example

PHP
$href = "http://lk.mysmpp.ru/xml/file.php";
// (example: $tmpfname = "C:\Program Files\file\test.jpg";)
$tmpfname = "name";
$requist['login'] = "login";
$requist['passsword'] = "passsword";
if(PHP_VERSION_ID <  56000)
    $requist['file'] = '@' . $tmpfname;
else
    $requist['file'] = new CurlFile($tmpfname, 'image/jpg'); 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $href);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requist);
$result = curl_exec($ch);
curl_close($ch);
 
echo $result;
Last modified 5mo ago