Overview
Telecom Lookup Tools
Powered By GitBook
Sending - Embedded
Sending an MMS while embedding the file directly in the POST message.
The embedded file must be base64 encoded, which is a simple process in most languages. PHP is simply:
1
$file_name = "file.jpg";
2
$file_data = base64_encode(file_get_contents("/tmp/".$file_name));
Copied!

Post Information

URL:
POST is required for this action
Argument
Required
Type
source
yes
int
destination
yes
int
file_name
yes
string
file_data
yes
string
message
no
string
shell
PHP+CURL
RESPONSE
Shell/CURL
1
base64image=$(base64 /tmp/file.jpg)
2
​
3
curl -v -X POST "https://api.teleapi.net/mms/send?token=XXXX" \
4
-d "source=13035551212&destination=13038884444&file_name=file.jpg&image=$base64image"
Copied!
Using PHP+CURL
1
<?php
2
​
3
​
4
$file_name = "file.jpg";
5
$directory = "/tmp/";
6
$file_data = file_get_contents($directory.$file_name);
7
​
8
$data = array("source" => "13035551212",
9
"destination" => "13038884444",
10
"file_name" => $file_name,
11
"file_data" => base64_encode($file_data)
12
);
13
​
14
$data = http_build_query($data);
15
​
16
$baseurl = "https://api.teleapi.net/mms/send?token=XXXX";
17
curl_setopt($ch, CURLOPT_POST, 1);
18
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
19
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
20
$retval = curl_exec($ch);
21
curl_close($ch);
22
​
23
$object = json_decode($retval);
24
print_r($object);
Copied!

Responses from API

Successfully Sent

data
This is your unique tracking ID for this SMS message. You can track this in delivery notifications.
1
{
2
"code":200,
3
"status":"success",
4
"data":"ea19aa71-4590-4e6b-a8ce-47e2b84c8091"
5
}
Copied!

Failed to Send

1
{
2
"code":400,
3
"status":"error",
4
"data":"Invalid source number"
5
}
Copied!
Last modified 9mo ago
Copy link