Hi Andrej,
Googling gave me one more option which seems to be working...
if (!isset($HTTP_RAW_POST_DATA))
$HTTP_RAW_POST_DATA = file_get_contents("php://input");
$input = $GLOBALS['HTTP_RAW_POST_DATA'];
Please guide me to which of the methods is a better to use?
Thanks a lot!!!
Cheers,
Amit
On Sun, Sep 21, 2008 at 12:29 AM, Andrej <[EMAIL PROTECTED]> wrote:
>
> Hi,
> php.ini parameter "always_populate_raw_post_data" should be set to
> TRUE if you want to read $GLOBALS['HTTP_RAW_POST_DATA']
>
> better way to post data is to do:
> Request response = builder.sendRequest("D=" +
> URL.encodeComponent(postData),...
>
> then you can access data in php with:
> $_REQUEST['D']
>
> Andrej.
>
>
> On Sep 20, 8:05 pm, "Amit Dhingra" <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I am trying to post string so as to pass the value from gwt to php using
> the
> > following code. Below is the code i am using in php to accept the posted
> > value.
> > Everytime I get an empty string. Am I missing something.
> > Please help!!!
> >
> > public void doPost(String postData) {
> > RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
> "http://localhost/JSONTEST/index2.php");
> >
> > try {
> > builder.setHeader("Content-Type",
> > "application/x-www-form-urlencoded");
> > Request response = builder.sendRequest("from gwt", new
> > RequestCallback() {
> >
> > public void onError(Request request, Throwable exception)
> {
> > // code omitted for clarity
> > }
> >
> > public void onResponseReceived(Request request, Response
> > response) {
> > // code omitted for clarity
> > Window.alert(response.getText());
> > }
> > });
> > } catch (RequestException e) {
> > Window.alert("Failed to send the request: " +
> e.getMessage());
> > }
> > }
> >
> > PHP Code
> > ....
> > $input = $GLOBALS['HTTP_RAW_POST_DATA'];
> > if ($input == "")
> > $input = "Error";
> > ...
> >
> > Thanks in advance... :)
> >
> > --
> > Warm Regards,
> > Amit Dhingra
> >
>
--
Warm Regards,
Amit Dhingra
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---