上传图片至https://sm.ms/,详见:http://blog.skyx.in/archives/164/ 1. [代码] [PHP]代码 ?php$url = 'https://sm.ms/index.php?act=upload';$image = curl_file_create(realpath('test.jpg'), 'image/jpg', 'test.jpg'); $ch = curl_init();c
1. [代码][PHP]代码
<?php $url = 'https://sm.ms/index.php?act=upload'; $image = curl_file_create(realpath('test.jpg'), 'image/jpg', 'test.jpg'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, ['smfile' => $image]); $data = curl_exec($ch); curl_close($ch); echo $data;