用header送出post表單
我想從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 / HTTP/1.0\r\n";
$out.="Host: 192.20.225.55/tts/cgi-bin/nph-talk\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, , 1F
02/11 23:34, 1F
→
02/12 00:07, , 2F
02/12 00:07, 2F
推
02/12 00:22, , 3F
02/12 00:22, 3F
→
02/12 00:23, , 4F
02/12 00:23, 4F
→
02/12 00:25, , 5F
02/12 00:25, 5F
→
02/12 00:27, , 6F
02/12 00:27, 6F
推
02/12 00:35, , 7F
02/12 00:35, 7F
※ 編輯: costbook 來自: 203.68.92.156 (02/12 01:07)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):
2
7
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
0
18