<?php
$username='AAA';
$password='XXX';
// initialise the curl request
$request = curl_init('https://www.******.jp/api3/');
// Set options for Basic Auth
curl_setopt($request, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($request, CURLOPT_USERPWD, "$username:$password");
// Set timeout 10 sec
curl_setopt($request, CURLOPT_TIMEOUT, 10);
// Set max redirections to 10
curl_setopt($request, CURLOPT_MAXREDIRS, 10);
// send a file
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => new CURLFile('./test.csv'),
'encode' => 'utf8',
'smstexttype' => 'csv',
'smstext' => 'test'
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
// Run request
$result=curl_exec($request);
// Get Status code
$status_code = curl_getinfo($request, CURLINFO_HTTP_CODE);
// Print result for debug puposes
print_r("Output result:" . $result . "\n");
print_r("Status Code: " . $status_code . "\n");
// close the session
curl_close($request);
?>
その他の言語についてもお問い合わせください。