note 69255 added to wrappers
| From: | ben dot johansen at gmail dot com | Date: | Tue, 29 Aug 2006 07:33:18 +0000 |
| Subject: | note 69255 added to wrappers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116449@lists.php.net to get a copy of this message | ||
In trying to do AJAX with PHP and Javascript, I came upon an issue where the POST argument from the
following javascript could not be read in via PHP 5 using the $_REQUEST or $_POST. I finally figured
out how to read in the raw data using the php://input directive.
Javascript code:
=============
//create request instance
xhttp = new XMLHttpRequest();
// set the event handler
xhttp.onreadystatechange = serviceReturn;
// prep the call, http method=POST, true=asynchronous call
var Args = 'number='+NbrValue;
xhttp.open("POST", "http://<?php echo
$_SERVER['SERVER_NAME'] ?>/webservices/ws_service.php", true);
// send the call with args
xhttp.send(Args);
PHP Code:
//read the raw data in
$roughHTTPPOST = file_get_contents("php://input");
//parse it into vars
parse_str($roughHTTPPOST);
----
Server IP: 216.194.113.175
Probable Submitter: 24.20.213.84
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/wrappers.php
Edit -- https://master.php.net/note/edit/69255
Del: integrated -- https://master.php.net/note/delete/69255/integrated
Del: useless -- https://master.php.net/note/delete/69255/useless
Del: bad code -- https://master.php.net/note/delete/69255/bad+code
Del: spam -- https://master.php.net/note/delete/69255/spam
Del: non-english -- https://master.php.net/note/delete/69255/non-english
Del: in docs -- https://master.php.net/note/delete/69255/in+docs
Del: other reasons-- https://master.php.net/note/delete/69255
Reject -- https://master.php.net/note/reject/69255
Search -- https://master.php.net/manage/user-notes.php