Android Question Sending strings to a URL (PHP,SQL,URL Encoding)

aidymp

Well-Known Member
Licensed User
Longtime User
Hi all,
I send this to my PHP "08:00:27:8F:F4:EC" however in the database it is show as "08%3A00%3A27%3A8F%3AF4%3AEC" I can see that "%3A" is replacing ":" that is not too much of a problem as I never read it back, but if I needed too I could easily change this back to its original, but I would prefer it to be stored in the database as "08:00:27:8F:F4:EC"

I have read somewhere that the post I send does nothing to the string prior to sending the request. So it is either my database, or php?? Am I correct? if so what would I need to modify?

My experience with SQL, PHP is minimal so please make any answer as simple as possible! ;)

Thanks

Aidy
 

aidymp

Well-Known Member
Licensed User
Longtime User
Why are you using PHP at all? Implement your server with B4J. It will be much simpler.

Where is the code that sends the string?

Hi im sure it will be simpler, but as I just got it all working with PHP i would like to launch ASAP, I really dont want to wait any longer.

my app will use credits that the user can buy with cash! (for this I will be using B4J to monitor emails from paypal and then update the database!)

I now know it will be simpler using B4J but I have auto updating, so can implement this in the future!

for now! i get the devices mac address, and enter it into a db, if it exits it just returns the amount of credits if not it adds the mac and defaults to 10 credits!

this is performed with this code!

B4X:
' This is the part that performs contacts the db.
    Dim Login As HttpJob
    Login.Initialize("checkcredits", Me)   
' secret.php is just so no one can see where!
'mac is my mac address uppercased, so in the log it says 08:00:27:8F:F4:EC
    Login.Download2("http://secret.php", Array As String("action","cr","mac", mac))
    Login.Release

The jobdone sub does nothing as Its not required at this stage. the program works correctly, and im quite happy for now, but I would like the database to entry to read "08:00:27:8F:F4:EC" instead of "08%3A00%3A27%3A8F%3AF4%3AEC"

Thanks Aidy
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
PHP:
echo urldecode ("08%3A00%3A27%3A8F%3AF4%3AEC");
 
Upvote 0
Top