I have some data that compressed with gzip in an application from here:
app.myaddress.com/data/api/1
.
The data contains several parameters in JSON format like follows:
{ "id": 1, "data": "abcabcabcabcabc" //this is the compressed data }
I need to check the compressed data
with another 3rd party service, we can just say the address like follows: app2.myaddress.com/check_data/abcabc
by API request, but it’s needed a header authentication:
{ "content-type": "application/json", "api-key": 123456 }
app2.myaddress.com
will return data JSON format like follows:
{ "name": "hello", "address": "australia" }
What I need to do is just checking a data by accessing URL like:
app.myaddress.com/data/api/checked/1
then the controller will process the data include checking through app2.myaddress.com
and return the value into app.myaddress.com
Advertisement
Answer
Solved by @rafitio:
You can use cURL or Guzzle to access both URL inside your function. Here is the documentation of Guzzle: http://docs.guzzlephp.org/en/stable/request-options.html