File "send.php"
Full path: /www/geye_t/pict/api/upload/send.php
File size: 803 B
MIME-type: text/x-php
Charset: utf-8
<?php
$file = 'IMG_5501.JPG';
$content = base64_encode(file_get_contents($file));
$data = array('fileName' => "IMG_5501.JPG",
'image' => "data:image/jpeg;base64,".$content
);
$data_json = json_encode($data);
echo $data_json ."\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://penta-05.ptgw2.net/a/');
$result=curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
//$res_json = json_decode($result,true);
//var_dump($res_json);
//echo $res_json['return1'] ."\n";
//echo 'RETURN:'.$result;
print 'HTTP CODE:' .$httpcode;
?>