안드로이드 애플 리케이션에서, 내 PHP 스크립트를 호출합니다.PHP에서 POST 매개 변수를 추출하는 방법
HttpPost httppost = new HttpPost("http://www.smth.net/some.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("pa", "555"));
nameValuePairs.add(new BasicNameValuePair("pb", "550"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
}
내 PHP 스크립트에서 "pa"및 "pb"값을 얻으려면 어떻게해야합니까?
나는 $ _POST [ 'pa']와 urldecode ($ _ POST [ 'pa'])를했지만, 둘 다 빈 문자열을 제공합니다.
보내려는 내용을 보려면'print_r ($ _ POST) '을 사용해 보셨습니까? –
@ MarkOrmesher 이것은 무엇을 할 것입니까? – Kraken
'$ _POST'에 저장된 모든 것을 보여줄 것입니다. 만약 그것이 비어 있다면, 문제는 안드로이드 앱에 있음을 알게됩니다. –