I want to make a small PHP script that will check a web app periodically. The communication will be only in json. The code will run on Google App Engine.
First request will be an HTTP POST request with form data like this: username=user&password=pass
POST http://www.example.com/login HTTP/1.1
If login fails the response json will be:
{
"message": "Failed login"
}
If successful:
{
"response": "OK",
"username": "user",
"protocol": "http"
}
Subsequent requests will be GET, POST and PUT requests containing json and also the response will be in json.
This code will be run by Google App Engine's Cron for PHP ones a day.
Since I have little knowledge of PHP, I would like to know how I should implement this.
- How do I make the http request to the web app.
- How do I remember login/authentication headers from one request to another.
- How do I handle reading, writing and modifying of json in PHP.
All I need is a basic example and guidelines to get me started.
Thank you in advance.
Tase