Forums Register Login

Problem in posting json data from android

+Pie Number of slices to send: Send
Hi,

I have trouble posting json on a php server.

my code is -



The status code from server is 200 but when i print response stream on logcat in eclipse i am getting undefined index message for method, event_id, device_id, device_token, session_id.

Notice: Undefined index: method in /mypath/file.php on line 17

INFO/Read from Server 200(493):

INFO/Read from Server 200(493): Notice: Undefined index: event_id in /mypath/file.php on line 18

INFO/Read from Server 200(493):
..............................................
..............................................................



What I am doing wrong ? Is this is because of server side php file or something wrong in java code?

Thanks
+Pie Number of slices to send: Send
I don't see what this has to do with Android. Apparently the JSON that is being posted can't be handled by that PHP page. If this was my problem I'd create a Java desktop client application that gets this right before integrating it into an Android app; it's much easier to debug that way.
+Pie Number of slices to send: Send
Thanks for replying....

so the 'undefined index' problem is because of php page?

+Pie Number of slices to send: Send
Not quite - it's because the PHP page is getting something other than what it can handle. Either the PHP code is incorrect, or the JSON is different than what the PHP code expects. We can't really speculate which one of these it is, but *you* can, since both the JSON and the PHP are under your control, and amenable to being changed by you.
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2745 times.
Similar Threads
read php session from android
How to post data from android app to php page
Sending a jason object via Post
Client Android JSON--- Server side PhP .....error..!!
Connect to server on LAN
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:37:28.