My question is, how can I send a data (for example a text box) from a web mobile app (cordova) to my own server and save that data in server?
I tried post method but I couldn't run it completely.
You have to use AJAX request to make post requests to the PHP server.
You can find a documentation Ajax request using pure Javascript here.
Or using Jquery Ajax API
Watch out for CROS and Acces Control if you are not in localhost.
Related
I have a website that generates different JSON that need to be used in the future request.
The request could be done by CURL but I'll use the Advanced Rest Client to send the request.
The website is in PHP.
Advanced REST Client is a pluggin of Chrome.
Do you know how I could generate my request in the REST Client from the website without copy and paste the JSON code?
I've tried by curl but it doesn't work.
The json used in the REST client is working
Just need to make a tunnel between the website and the REST Client with any JSON file
Do you know how I could generate my request in the REST Client from the website
You can't.
Advanced REST Client is primarily a debugging tool. It isn't designed to be used by websites.
If you want to make an HTTP request to a RESTful web service from a website then either:
Write client-side code in JavaScript that uses fetch, XMLHttpRequest or a library that wraps one of them such as axios or
Write server-side code in your server-side language of choice and generate whole HTML pages on demand.
I am making an desktop javafx application for school which work online server communication via json and php. I want to send a image file taken form java application to php server
You can make use of a http library like unirest to make your http request. sending images will be in the form
Unirest.post('URL_TO_POST_TO')
.header("accept", "application/json")
.field("image", new File(pathToImage))
.asJson();
I need to create a protocol (an API) to send data (encrypted) from my php server (my web site) to a specific Android phone. Or send data from Android phone to my php server. I need both methods. Data security is essential.
(by clicking in a button on web site or by clicking in a button in my Android phone)
I have searched here but i only see questions about sending data without concern of security.
Can anyone explain me how to do that?
I do pretend to know:
how to discover my Android phone in php side?
how can I send data from php to Android?
how can I send data from Android to php?
how can I use a secure connection?
how can I encrypt and decrypt my data?
Edited:
My urgente problem is: how to get data from php (safely) in android side? Give me an example...
Thanks
To communicate securely between an Android device and a PHP server I would use HTTPS. This article on the Android Developer site will help with your research in that department:
http://developer.android.com/training/articles/security-ssl.html
Using HTTPS will preclude you having to develop your own protocol.
Answering your bullet points:
You'd need to either set up a web server on the Android device so the PHP app can contact it, or have the Android device periodically call home to the PHP app. The second option is much, much more straightforward.
HTTPS
HTTPS
HTTPS
This is built into SSL / TLS / HTTPS, you won't need to handle it.
I hope that helps :-)
I am trying to write a Sencha Touch application that I can package in PhoneGap for iOS, Android etc...
The app allows you to input some data which I would like to save to my backend server using PHP/MySQL. It all works when I use an AJAX proxy as I am testing the app on the same server as my database.
However when I package it for mobile devices I run into the same-domain restrictions of AJAX calls. So I modified it to use the JSONP proxy and I can read the data from the server database but have no idea how to write records back. Do I need to somehow pass the data in the GET request? Obviously the server side PHP needs to be different because of the callbacks and the fact JSONP is forced to used GET requests. I am also trying to get CORS working but currently no success.
So my question is how would I implement writing data back to my backend server from a packaged mobile Sencha app running on a mobile device? Either using JSONP if that is even possible or any other alternatives are welcome?
Many Thanks…
I am working with Android 2.2. I currently have the application wrapped in phonegap with Sencha. I have forms that use an Ajax request to post the information and send it to an email. It all works fine before I wrap it in Phonegap. I have read that you cannot do Ajax requests through phonegap though. Is there any way I can get this to work?
You can do AJAX requests through a Phonegap app. I have an app running on both Android and iPhone and it works fine for both local (in app) and remote (mobile to server) communications. I use jQuery, but I don't suspect that what library I use matters.