|
@@ -0,0 +1,50 @@
|
|
|
+<?php
|
|
|
+$content=file("/mnt/upload_file.txt");
|
|
|
+$url = $content[0];
|
|
|
+$arr = explode("/",$content[1]);
|
|
|
+$file=trim($arr[count($arr)-1]);
|
|
|
+$filename = '/mnt/upload_file.txt';
|
|
|
+$curl = curl_init();
|
|
|
+$curl_log = fopen($filename, 'a+');
|
|
|
+
|
|
|
+curl_setopt_array($curl, array(
|
|
|
+ CURLINFO_HEADER_OUT => 1,
|
|
|
+ CURLOPT_URL => $content[0],
|
|
|
+ CURLOPT_HEADER => 1,
|
|
|
+ CURLOPT_RETURNTRANSFER => 1,
|
|
|
+ CURLOPT_BINARYTRANSFER => 1,
|
|
|
+ CURLOPT_FAILONERROR => 1,
|
|
|
+ CURLOPT_ENCODING => "",
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
+ CURLOPT_CONNECTTIMEOUT => 30,
|
|
|
+ CURLOPT_STDERR => $curl_log,
|
|
|
+ CURLOPT_FOLLOWLOCATION => 0,
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS,
|
|
|
+ CURLOPT_SSL_VERIFYPEER => 0,
|
|
|
+ CURLOPT_SSL_VERIFYHOST => 0,
|
|
|
+ CURLOPT_CUSTOMREQUEST => "PUT",
|
|
|
+ CURLOPT_POSTFIELDS => array(''=> new CURLFILE(trim($content[1]),"application/zip",$file)),
|
|
|
+ CURLOPT_HTTPHEADER => array(
|
|
|
+ "Content-Type: multipart/form-data"
|
|
|
+ ),
|
|
|
+ CURLOPT_NOSIGNAL => 1,
|
|
|
+ CURLOPT_VERBOSE => 1,
|
|
|
+));
|
|
|
+
|
|
|
+$response = curl_exec($curl);
|
|
|
+$response_text="result: 0";
|
|
|
+if($response) {
|
|
|
+ $response_text="result: 1";
|
|
|
+}
|
|
|
+else{
|
|
|
+ $response_text="result: 0";
|
|
|
+}
|
|
|
+$error=curl_error($curl);
|
|
|
+curl_close($curl);
|
|
|
+
|
|
|
+fwrite($curl_log,$response_text."\n");
|
|
|
+fclose($curl_log);
|
|
|
+
|
|
|
+echo $response_text;
|
|
|
+?>
|