Re: 用header送出post表單
※ 引述《costbook (Sissy's mate)》之銘言:
我想從AT&T的web TTS系統取得wav檔案,
(對方的cgi會回應一個wav檔案)
這是錯誤訊息:
HTTP/1.1 400 Bad Request Date: Wed, 11 Feb 2009 17:03:09
GMT Server: Apache/2.0.52 (CentOS) Content-Length: 326
Connection: close Content-Type: text/html;
charset=iso-8859-1
Bad Request
Your browser sent a request that this server could not
understand.
Apache/2.0.52 (CentOS) Server at
192.20.225.55/tts/cgi-bin/nph-talk Port 80
我修正程式了,紅字的部份
$fp = fsockopen("192.20.225.55"
,80, $errno, $errstr);
if (!$fp){
echo "----->".$errstr."<-----";
die("$errstr ($errno)\n");
}else{
$data = "txt=".$_GET['txt'];
$out="POST /tts/cgi-bin/nph-talk HTTP/1.1\r\n";
$out.="Host: http://192.20.225.55\r\n";
$out.="Content-type: application/x-www-post\r\n";
$out.="Content-length: " . strlen($data) . "\r\n";
$out.="Accept: */*\r\n";
$out.="\r\n".$data."\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.68.92.156
→
02/11 23:34,
02/11 23:34
→
02/12 00:07,
02/12 00:07
推
02/12 00:22,
02/12 00:22
→
02/12 00:23,
02/12 00:23
→
02/12 00:25,
02/12 00:25
→
02/12 00:27,
02/12 00:27
推
02/12 00:35,
02/12 00:35
※ 編輯: costbook 來自: 203.68.92.156 (02/12 01:07)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.135.231.23
→
02/12 01:38, , 1F
02/12 01:38, 1F
→
02/12 01:38, , 2F
02/12 01:38, 2F
→
02/12 01:39, , 3F
02/12 01:39, 3F
→
02/12 01:39, , 4F
02/12 01:39, 4F
→
02/12 01:42, , 5F
02/12 01:42, 5F
→
02/12 01:44, , 6F
02/12 01:44, 6F
推
02/12 03:29, , 7F
02/12 03:29, 7F
→
02/12 04:41, , 8F
02/12 04:41, 8F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 3 篇):