請問各位大大 :
如果我想在windows底下透過php語法create一個檔案到HDFS上,
那目前這個程式碼測出來毫無反應且無任何錯誤訊息,
想請教各位前輩指教!
代碼:
<?php
$url = "http://140.128.80.118:50070/webhdfs/v1/tmp/123/123.txt?user.name=hadoop&user.passward=hadoop&op=CREATE$overwrite=true";
$fp=fopen("D:\\123.txt",'r');
$chNN = curl_init();
curl_setopt($chNN, CURLOPT_URL, $url);
curl_setopt($chNN, CURLOPT_HEADER, true);
curl_setopt($chNN, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($chNN, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chNN, CURLOPT_PUT, true);
$chDN = curl_copy_handle($chNN);
$response = curl_exec($chNN);
$responseInfo = curl_getinfo($chNN);
curl_close($chNN);
echo $response;
if ($responseInfo['http_code'] == 307) {
curl_setopt($chDN, CURLOPT_URL, $responseInfo['redirect_url']);
curl_setopt($chDN, CURLOPT_INFILE, $fp);
$response = curl_exec($chDN);
$responseInfo = curl_getinfo($chDN);
fclose($fp);
curl_close($chDN);
echo $response;
}
?>