Se da scriptul de mai jos.
Vreau sa mai adaug functia asta intr-un modul whmcs ,
adica script-ul asta ma trimite un fisier pe un alt servar, dar nu o executa comanda .
Asi fi recunascator pt ajutor?
Cod: Selectaţi tot
function serverppc_sendcurl($params)
{
//This needs to be the full path to the file you want to send.
/* curl will accept an array here too.
* Many examples I found showed a url-encoded string instead.
* Take note that the 'key' in the array will be the key that shows up in the
* $_FILES array of the accept script. and the at sign '@' is required before the
* file name.
*/
$url = 'http://iptvsat.levinetit.eu/acc.php';
$file_name_with_full_path = realpath("/home/neti/public_html/th123/date.txt");
$post = array('extra_info' => 'levinetit','file_contents'=>'@'.$file_name_with_full_path);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if ($result == false) {
print_r("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
# log error if curl exec fails
}
curl_close($ch);
return $result;
}
iar codul fisierului acc.php este:
Cod: Selectaţi tot
<?php
$uploaddir = realpath('/home/th1355/') . '/';
$uploadfile = $uploaddir . basename($_FILES['file_contents']['name']);
if (move_uploaded_file($_FILES['file_contents']['tmp_name'], $uploadfile)) {
} else {
}
print_r($_POST);
?>