2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function send_file ($fp,$size)
6 global $billing_server;
10 if ($billing_server == "" || $billing_user == "" || $billing_pass == "") {
12 include_once("{$GLOBALS["srcdir"]}/need_service.inc");
17 $url = "$billing_server/~$billing_user/";
19 return actually_send_file($fp,$size,$url,$billing_user,$billing_pass);
22 function actually_send_file ($fp, $size, $url, $user, $pass)
25 $filename = date("Y-m-d-G:i:s");
28 curl_setopt ($ch, CURLOPT_URL, $url.$filename);
29 curl_setopt ($ch, CURLOPT_SSLVERSION, 3);
30 curl_setopt ($ch, CURLOPT_UPLOAD, 1);
31 curl_setopt ($ch, CURLOPT_PUT, 1);
32 curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
33 curl_setopt ($ch, CURLOPT_INFILE, $fp);
34 curl_setopt ($ch, CURLOPT_INFILESIZE, $size);
35 curl_setopt ($ch, CURLOPT_USERPWD, "$user:$pass");
36 curl_setopt ($ch, CURLOPT_MUTE, 0);
38 $ret = curl_exec ($ch);