Indexへ戻る
PHP側の処理

  open または send メソッドで送信された値は、PHP側ではフォームからサブミットされたと同様に、$_POSTまたは$_GETで値を受け取ります。
そして処理後、出力 charset を指定し、ヘッダーと共に処理結果を返します。(必要なら、URIエンコードします。)
下の例では、ファイルを読み込んでデータを加工し、その結果を返しています。
■PHP側の処理例
 <?php

$filename 
$_POST['filename'];

$result  '';

$fp fopen($filename'r');
for (
$i=2$buffer fgets($fp1024); $i++) {
    
$buffer mb_convert_encoding($buffer'UTF-8''SJIS');
    
$data   explode(','$buffer);

    
$result .= $data[0] . '&nbsp;&nbsp;' $data[1];

    
・・・・(出力内容の編集など)

}

//URIエンコード
//$result = rawurlencode($result);

//出力charsetをut-8に
mb_http_output 'UTF-8' );

//ヘッダ
header ("Content-Type: text/html; charset=utf-8");
echo(
$result);

?>