Json and Internal db - php

I need to save the information that I get from a json, the result did a webserver with php MySql connection, and save me the information in an internal db, so I do not have to download every time the json, what can I use to save information from the json directly to the database?

Create your own SQLite data base in the android device and the table should like the web data base.If your web data base is updated then your android device need to be updated.

Just store the data in your app's SQLite database:
http://developer.android.com/guide/topics/data/data-storage.html#db

Related

How to get Tally Prime data in PHP server

Need to fetch tally data file in php server.How to do that in laravel.
I tried with CData connect server but it was not helpful.I want to fetch tally data file record in php server.
CData connect server URL :
https://www.cdata.com/kb/tech/tally-connect-php.rst#Create-a-Virtual-MySQL-Database-for-Tally-Data_9ykr6hah3
It is not recommended to get tally data from outside LAN,
as it involves exposing all tally data to world
If tally is running in same system as your php server then you can use curl to send request in XML
Refer this - how to insert data into tally using php?
and for xmls use this postman collection

How can I secure JSON web service?

I have location data containing lat,long,location_name to be shown in the map. Only logged in users can see this map. What I did was that I used php and with a select * to MySQL DB and then I used json_encode to format the data in usable way and echoed it to be grabbed in the front-end and used in map api. This php file echoing the JSON file is called mapData.php
I want this file to not be accessible even from logged user. I came across session and request headers in the mapData.php file (internal api file)but then again if h hacker sign up to my service and open dev console he/she can see the received file and with one side requesting tool can put the header and see the data. Or maybe changing the access level with Linux but I have no idea how.
Another method is uglify and minifying JSON but since I am having 29000 rows in my dB with another inner join I think it will slow down the process. Any suggestion for securing this internal api so that even logged in user cannot access to it?
I would hide the map data file in a subdirectory, then use a service to access the data file and retrieve just the data you need. If you absolutely need the 29,000 rows at once, then there's not much you can do. Even if you encrypt it, eventually the data is going to be in native JavaScript format, and then it's just a matter of running a debugger and peering in the data structures.

Swift connection to database without php output

I have a simple question about the database structure and connection to my iOS App.
Is there any solution to get datas from my databse using Swift without PHP output? I want a PHP script which connects to the database and echo the result. The app should load the datas directly from the database like PHP (mysqli).
It is really important for me to protect the datas in the database! Nobody should see the datas when he opens a URL in the browser of my server.

Android/PHP - Best way to synchronize local and remote databases

I have an Android app that needs to receive some data from the webserver. I already got everything working, my question is.. What's the best way to synchronize data from the webserver if I'm always adding some data to it's remote database through a HTML form?
I thought of putting a timestamp, then I can receive the data with the timestamp, I would be able to compare the timestamps with each data entry from my Android app database, then, update or add the information to my local database.
What's the best way to do it? Should I put a timestamp to each entry I put in the remote and local server? If yes.. How does timestamp works in PHP(MySQL) and Android(SQLite)?
Thanks in advance! ;D
I'm assuming the data is read-only to the application and only changes on the server.
Here's how we do something similar:
The application passes up a "last_sync_date" to the server. If the last_sync_date is null, the server passes back all data.
The server always passes back a last_sync_date back to the application. The last_sync_date is in UTC server time. The application stores the last_sync_date.
Obviously, last_sync_date will be null the first time the app sends it, so the first time, it gets all data. From then on, it only gets new data.
Yes, a timestamp on each entry is used to determine which records are new/modified.
If need be, add a deleted column to each entry to "delete" them.

How can I get my javascript gererated data from the client to the server via PHP

A while back I wrote a rather long javascript procedure for organizing data we receive at work. The user simply paste in the mess we get and script throws out all the worthless info and generates a nice cleaned up data table.
I would like to add the ability to then transfer the processed information to the mySQL database. I'm growing a bit more comfortable using javascript, but I don't have close to the time or know-how to recreate the long processing procedure in PHP. How should I prep the data in javascript to most efficiently hand off the data to the server and have PHP insert it into mySQL tables?
The less PHP server side the better, although I doubt it would be safe to have a PHP page that blindly followed any instructions a referring page might send it.
At this point the data my script presents in the browser looks a lot like mySQL records already.
ex.
(Wilson, Paul, 1000400, A399)
(Smalls, Kalah, 4993944, B11)
(Chase, Danny, 244422, B133)
(Larson, Jay, 3948489, J39)
...
Thanks!
If you could have the data in a JSON array.
Then on the php side use json_decode to pull the data in as an array loop through it and do your updates and inserts for your data in MySQL.
http://php.net/manual/en/book.json.php

Categories