ajaxリクエストはPOST変数を送信しません(またはPHPスクリプトはそれらを受信しません)

ajax forms http-post php
ajaxリクエストはPOST変数を送信しません(またはPHPスクリプトはそれらを受信しません)

次の情報を(POST経由で)送信するAJAXリクエストがあります。 要求されたPHPファイル内の「$ _POST」スーパーグローバルが空であることを除いて、すべてが順調です。

Firebugのヘッダーと投稿タブを提供しています:

[ヘッダー]タブ:

Response Headers view source
Date Sun, 23 Jan 2011 08:41:03 GMT
Server Apache
X-Powered-By PHP/5.2.13
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Content-Length 127
Connection close
Content-Type text/html


Request Headers view source
Host xx
User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Referer http://xx/florin2/cautare
Content-Length 2325
Content-Type text/plain; charset=UTF-8
Cookie PHPSESSID=8367d170xx

投稿タブ:

Parts multipart/form-data
titluPublic PDG Archivarius
nr_versiune
nume_developer Astonsoft
site_developer
site_produs
pret_vechi
pret_actual 9.95
link_pret /nph-softsell.cgi?item=2304-3&affiliate=441937
size 20.00
zilePromo 0
startPromo 0000-00-00
date_added 2009-02-01
dataupdate 0000-00-00
rating 0
nr_download 191
id_pad 0
featured 0
license Shareware
os Windows
id_subcat_f 102
subtitlu An advanced zipping utility wich allows to recover .zip passwords and do anti-virus scanni...
description An advanced zipping utility wich allows to recover .zip passwords and do anti-virus scanning.
features
review
pro
contra
requirements
limitations








Source
Content-Type: multipart/form-data; boundary=gRNHZ7wzOS
--gRNHZ7wzOS
Content-Disposition: form-data; name="titluPublic"

PDG Archivarius
--gRNHZ7wzOS
Content-Disposition: form-data; name="nr_versiune"


--gRNHZ7wzOS
Content-Disposition: form-data; name="nume_developer"

Astonsoft
--gRNHZ7wzOS
Content-Disposition: form-data; name="site_developer"
--gRNHZ7wzOS
Content-Disposition: form-data; name="site_produs"


--gRNHZ7wzOS
Content-Disposition: form-data; name="pret_vechi"


--gRNHZ7wzOS Content-Disposition: form-data; name="pret_actual"

9.95
--gRNHZ7wzOS
Content-Disposition: form-data; name="link_pret"

/nph-softsell.cgi?item=2304-3&affiliate=441937
--gRNHZ7wzOS
Content-Disposition: form-data; name="size"

20.00
--gRNHZ7wzOS
Content-Disposition: form-data; name="zilePromo"

0
--gRNHZ7wzOS
Content-Disposition: form-data; name="startPromo"

0000-00-00
--gRNHZ7wzOS
Content-Disposition: form-data; name="date_added"

2009-02-01
--gRNHZ7wzOS
Content-Disposition: form-data; name="dataupdate"

0000-00-00
--gRNHZ7wzOS
Content-Disposition: form-data; name="rating"

0
--gRNHZ7wzOS
Content-Disposition: form-data; name="nr_download"

191
--gRNHZ7wzOS
Content-Disposition: form-data; name="id_pad"

0
--gRNHZ7wzOS
Content-Disposition: form-data; name="featured"

0
--gRNHZ7wzOS
Content-Disposition: form-data; name="license"

Shareware
--gRNHZ7wzOS
Content-Disposition: form-data; name="os"

Windows
--gRNHZ7wzOS Content-Disposition: form-data; name="id_subcat_f"

102
--gRNHZ7wzOS
Content-Disposition: form-data; name="subtitlu"

An advanced zipping utility wich allows to recover .zip passwords and do anti-virus scanni...
--gRNHZ7wzOS
Content-Disposition: form-data; name="description"

An advanced zipping utility wich allows to recover .zip passwords and do anti-virus scanning.
--gRNHZ7wzOS
Content-Disposition: form-data; name="features"


--gRNHZ7wzOS
Content-Disposition: form-data; name="review"


--gRNHZ7wzOS
Content-Disposition: form-data; name="pro"


--gRNHZ7wzOS
Content-Disposition: form-data; name="contra"


--gRNHZ7wzOS
Content-Disposition: form-data; name="requirements"


--gRNHZ7wzOS
Content-Disposition: form-data; name="limitations"


--gRNHZ7wzOS--

非常に長い投稿とありがとうございます。

更新

polarblauが示唆したように、「echo file_get_contents( ‘php:// input’);」を試しました。次を出力します。

Content-Type: multipart/form-data; boundary=zMgU0RnQIk

--zMgU0RnQIk
Content-Disposition: form-data; name="titluPublic"

Feldenkrais Pelvic Clock Variations
--zMgU0RnQIk
Content-Disposition: form-data; name="nr_versiune"


--zMgU0RnQIk
Content-Disposition: form-data; name="nume_developer"

Integrated-Learning
--zMgU0RnQIk
Content-Disposition: form-data; name="site_developer"


--zMgU0RnQIk
Content-Disposition: form-data; name="site_produs"


--zMgU0RnQIk
Content-Disposition: form-data; name="pret_vechi"


--zMgU0RnQIk
Content-Disposition: form-data; name="pret_actual"

7
--zMgU0RnQIk
Content-Disposition: form-data; name="link_pret"

/nph-softsell.cgi?item=14294-5&affiliate=441937
--zMgU0RnQIk
Content-Disposition: form-data; name="size"

20.00
--zMgU0RnQIk
Content-Disposition: form-data; name="zilePromo"

0
--zMgU0RnQIk
Content-Disposition: form-data; name="startPromo"

0000-00-00
--zMgU0RnQIk
Content-Disposition: form-data; name="date_added"

2009-02-01
--zMgU0RnQIk
Content-Disposition: form-data; name="dataupdate"

0000-00-00
--zMgU0RnQIk
Content-Disposition: form-data; name="rating"

0
--zMgU0RnQIk
Content-Disposition: form-data; name="nr_download"

261
--zMgU0RnQIk
Content-Disposition: form-data; name="id_pad"

0
--zMgU0RnQIk
Content-Disposition: form-data; name="featured"

0
--zMgU0RnQIk
Content-Disposition: form-data; name="license"

Shareware
--zMgU0RnQIk
Content-Disposition: form-data; name="os"

Windows
--zMgU0RnQIk
Content-Disposition: form-data; name="id_subcat_f"

7
--zMgU0RnQIk
Content-Disposition: form-data; name="subtitlu"

Feldenkrais Lesson Pelvic Clock Variations This Feldenkrais lesson takes the theme of the ...
--zMgU0RnQIk
Content-Disposition: form-data; name="description"

Feldenkrais Lesson Pelvic Clock Variations This Feldenkrais lesson takes the theme of the Pelvic Clock in other directions. Its value lies in the slightly different demands it places on your nervous system. This is how you can develop with variation of a Feldenkrais Lesson. It is very useful to do this. It helps in developing the subtle and intricate qualities of awareness that a Feldenkrais lesson and Feldenkrais Practitioners are renowned for. Develop a greater mobility with your pelvis.
--zMgU0RnQIk
Content-Disposition: form-data; name="features"


--zMgU0RnQIk
Content-Disposition: form-data; name="review"


--zMgU0RnQIk
Content-Disposition: form-data; name="pro"


--zMgU0RnQIk
Content-Disposition: form-data; name="contra"


--zMgU0RnQIk
Content-Disposition: form-data; name="requirements"


--zMgU0RnQIk
Content-Disposition: form-data; name="limitations"


--zMgU0RnQIk--

これは非常に優れていますが、「$ _ POST」に値が入力されない理由はまだわかりません。 `$ _SERVER [‘CONTENT_TYPE’] = ‘multipart / form-data’;`を強制しようとしましたが、結果はありませんでした。

  1  0


ベストアンサー

  • bradino.com *のhttp://www.bradino.com/php/empty-post-array/[This guy]は、この場合の優れたデバッグ方法を提案しているようです。

$data = file_get_contents('php://input');

これにより、「生の受信メッセージ」が表示されます。 これが実際に受信データを持っていることを示している場合、彼はリクエストを行うときに混乱した場合にコンテンツタイプを強制することを提案します。

if(empty($_SERVER['CONTENT_TYPE'])){
     $type = "application/x-www-form-urlencoded";
     $_SERVER['CONTENT_TYPE'] = $type;
}

1


タイトルとURLをコピーしました