POSTデータをPHPスクリプトに送信するスクリプトを作成した会社と協力しています(これはすべてセットアップされ、ポートが適切に転送されているなどです)。
問題は、私のスクリプトが POST 要求を処理するように設定されていないということです。
これは彼らのスクリプトです:
試す
strPost = strPost.Trim.Replace(" ", "%20")
Dim objRequest As HttpWebRequest = WebRequest.Create(strPostURL)
objRequest.Method = "POST"
objRequest.ContentLength = strPost.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(strPost)
Catch eg As Exception
Finally
myWriter.Close()
End Try
Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
success = sr.ReadToEnd()
sr.Close()
success = "Post Successful"
Catch ex As Exception
success = ex.ToString
End Try
そして、ここに私のものがあります:
<?PHP
$website = $_POST['web'] ;
$name = $_POST['name'] ;
$tel = $_POST['tel'] ;
$town = $_POST['town'] ;
foreach($_POST as $key => $thisOne){
$out .= $key . ': ' . $thisOne ;
}
if($out)
mail('test@test.com', 'Test', $out) ;
?>
$_POST を使用するのが正しいので、スクリプトが POST データを処理するように設定されていないことの意味がわかりません。
返信ありがとうございます。私はそう思っていましたが、彼は私のスクリプトに欠陥があると断言しています。
これは彼が言っているエラーです:
彼はまだそのエラーが発生し、次のように言っています。
私たちが使用するコードは、Sales Force、Sage、および以前に行った他の 7 つのカスタム CRM 統合で機能します。
:(
ありがとう、http://apikitchen.com/で適切にテストできることがわかり、問題なく戻ってきました。ご協力いただきありがとうございます!あなたが言うように彼に違いない。
彼は今、新しいエラーが発生していると私に言っています!
彼は私に次のメッセージを送ってくれました。
Try
strPost = "name=lf&town=london&country=uk&web=www.lf.com&tel=0123456789&keywords=sales&pages=5&multivisit=multihitdt=2012/04/30%2014:31referrer=google&landing=home"
strPost = strPost.Trim.Replace(" ", "%20")
Dim objRequest As HttpWebRequest = WebRequest.Create("http://mysite.dyndns-remote.com/myscript.php")
objRequest.Method = "POST"
objRequest.ContentLength = strPost.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write("name=lf&town=london&country=uk&web=www.lf.com&tel=0123456789&keywords=sales&pages=5&multivisit=multihitdt=2012/04/30%2014:31referrer=google&landing=home")
Catch eg As Exception
Finally
myWriter.Close()
End Try
Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
success = sr.ReadToEnd()
sr.Close()
success = "Post Successful"
Catch ex As Exception
success = ex.ToString
End Try