0

I am working with an SMS API to send messages to people. We'd also like to get information for users who do not want to receive the messages any longer and so click on a link on the messages or simply reply with a code. As you know this is called an "opt-out".

This API claims that it does not provide the method to receive these people's information via the API but instead they can send the information about the people who opt out in JSON messages to a specified URL. And that URL should be able to handle those JSON responses. I made a simple diagram to describe this. enter image description here

The APIs I have consumed so far, they respond to you only upon sending a message. But I haven't ever worked with a SOAP/REST API that only sends messages and we are supposed to listen to those messages. How can this be done?

disasterkid
  • 6,948
  • 25
  • 94
  • 179

1 Answers1

1
<?php

json_decode($_REQUEST["APIJSON"])

//MYSQL THE DATA TO DBASE

?>
user733421
  • 497
  • 4
  • 14
  • will this receive the JSON response every time they are sent to our page? – disasterkid Sep 22 '14 at 08:16
  • yes! it's like any other "form submition" but instead of receiving an array of values, you'll receive a string (JSON). So you have to decode it $myarrayFromJson = json_decode($_REQUEST["APIJSON"]); – user733421 Sep 22 '14 at 08:18
  • sorry if I sound stupid now. you game me the correct answer but who clicks on the submit button here? can PHP handle the database insert automatically? – disasterkid Sep 22 '14 at 08:20
  • the API, probably using CURL http://stackoverflow.com/questions/3062324/what-is-curl-in-php – user733421 Sep 22 '14 at 08:22
  • The API who's sending the JSON message to our webpage does the Submit on our page? Or the page contains the code so that every time you receive a JSON message like this, submit the form so that the person information will be saved into the database? – disasterkid Sep 22 '14 at 08:34
  • The API will send a http request (submit) to your page. – user733421 Sep 22 '14 at 08:37