1. 程式人生 > >使用ByteArray向PHP後臺傳輸wav音訊資料

使用ByteArray向PHP後臺傳輸wav音訊資料

你的問題這幾天我一直在研究
確實是用phpPOST的辦法接受的
接受程式碼:
$xdata =  $GLOBALS[HTTP_RAW_POST_DATA];  
    if(empty($xdata)) {  
        $xmlstr = file_get_contents('php://input');  
    }  
    echo $_GET['hash']; 
    $wav = $xdata;//得到post過來的二進位制原始資料  
    $file = fopen("wav/".$filename,"w");//開啟檔案準備寫入  
    fwrite($file,$wav);//寫入  
    fclose($file);//關閉  
  
    echo "uploaded ok!";