update
This commit is contained in:
+6
-5
@@ -244,12 +244,14 @@ function api_test()
|
|||||||
|
|
||||||
function api_upload()
|
function api_upload()
|
||||||
{
|
{
|
||||||
|
$web = "https://demo.winxg.com";
|
||||||
|
|
||||||
$url = "https://telegra.ph/upload";
|
$url = "https://telegra.ph/upload";
|
||||||
|
$filePath = $_FILES["file"]["tmp_name"];
|
||||||
$filePath = $_FILES["file"]["tmp_path"];
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
|
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
|
||||||
'file' => new CURLFile($filePath)
|
'file' => new CURLFile($filePath)
|
||||||
));
|
));
|
||||||
@@ -257,15 +259,14 @@ function api_upload()
|
|||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
$jsonArr = json_decode($response, true);
|
$jsonArr = json_decode($response, true);
|
||||||
|
|
||||||
$src = $jsonArr[0]["src"] ?? "";
|
$src = $jsonArr[0]["src"] ?? "";
|
||||||
|
|
||||||
echo_json([
|
echo_json([
|
||||||
"code" => empty($src) ? 1 : 0,
|
"code" => empty($src) ? 1 : 0,
|
||||||
"msg" => "",
|
"msg" => "",
|
||||||
"data" => [
|
"data" => [
|
||||||
"id" => $_POST["id"],
|
"id" => $_POST["id"],
|
||||||
"src" => $src
|
"src" => $web . $src
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user