Android Question $_POST Array is Empty in XAMPP

lip

Active Member
Licensed User
Longtime User
I am trying to synchronize SQLite data on my tablet with a MYSQL Database on an XAMPP server (across a LAN for now). I have written a php script which works when called as localhost from a browser using $_GET in the php file. I then changed the $_GET's in my php file to $_POST and tried writing a record by calling job1.poststring(...) from my tablet. The php script runs and it returns half-sensible results to the tablet, but the $_POST array is empty ie echo var_dump($_POST) returns an empty array;

I have checked php.ini MaxPOST = 8Mb and I have tried including <form method = "post"> but not sure whether I have put this in the correct place.

B4ACode follows:-
B4X:
Dim Job1 As HttpJob
    Job1.Initialize("JobWriteEnergyRecord",Me)

Dim myPostString2 As String
    myPostString2 = "id=" & EnergyC.GetInt("ID") & _
    "&fromdate=" & EnergyC.GetLong("FromDate") & _
    "&todate=" & EnergyC.GetLong("ToDate") & _
    "&esigma=" & EnergyC.GetLong("EnergyOccupied")
           
Dim ServerString As String
    ServerString = "http://192.168.0.15/energy"
Job1.PostString(ServerString,myPostString2)

Has anyone else managed to get this working using XAMPP?
 

DonManfred

Expert
Licensed User
Longtime User
See the examples in my Signature on how to handle given parameters in php
 
Upvote 0

lip

Active Member
Licensed User
Longtime User
btw... You should use job.download if you want to start a GET-request....
if you do a POST-Request you need to check $_POST (or $_REQUEST (thats a mixed one from POST and GET....)

I AM using $_POST but the array is empty. The parameters are not being passed.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
U can use this example and strip down the fileuploads with it.
The rest of the code is sending a multipart-POST-Request to a php-Script. Including values given per Post
I have checked php.ini MaxPOST = 8Mb
Is it that much what you are sending? Is the data binary?
 
Upvote 0

lip

Active Member
Licensed User
Longtime User
U can use this example and strip down the fileuploads with it.
The rest of the code is sending a multipart-POST-Request to a php-Script. Including values given per Post

Is it that much what you are sending? Is the data binary?

The data is four integers . I have just tried the same B4A code on the same tablet but to a different intranet and it works perfectly. The problem mus be with my XAMPP server setup so I guess out of scope of this Forum! Thanks for your help anyway.
 
Upvote 0
Top