1

I hosted an empty page called api.php on a website

What I would like is to write a php or javascript script that will echo everything received from a callback function and display it without specifying the parameter of what the callback is sending ( as they may vary )

example :

 var message = MessageResource.Create(
             to: new PhoneNumber(toNumber),
             from: new PhoneNumber(fromNumber),
             body: msgBody,
             provideFeedback: true,
             statusCallback: new Uri("https://mywebsite/api.php"));// <--- the call back method will make a get or post request to the website I hosted 

Now what should I write in the api.php ?

I tried to read the documentation on the rest api but the problem is ... I don't know what or how many parameter the statusCallback will send, so I want something like : no matter what http-request is coming , display the data in a human-friendly way.

Note : I'm aware of the previously answered question on Http Test server that accept GET/POST where sites like http://requestb.in/ and http://httpbin.org/, do the 90% job I'm trying to do , but I'm trying to do the same thing they are doing but using my own personal link so I can control the data the way I want

(the data being sent have 16k lines , and I want to chose when to erase them or do whatever)

    -
Community
  • 1
  • 1
napi15
  • 2,354
  • 2
  • 31
  • 55
  • 1
    In your code, how do you know the method, is it GET or POST? Also, what's in `msgBody`? Seeing the contents might be helpful in understanding how it needs to be received. But this is assuming I understand what you're asking., – Waxi Mar 10 '17 at 19:57
  • 1
    This is an incredibly broad topic, I'm doubtful you will be able to get very helpful answers. Take a look at other PHP REST API implementations. I've had great success building on top of [league/fractal](http://fractal.thephpleague.com/) – Jeff Lambert Mar 10 '17 at 20:04
  • @AmericanSlime The callback method will make a POST request , the msg body is what the user will fill from an imputBox.text , so let's say my only focus is how to receive a post request (without knowing the parameter ) – napi15 Mar 10 '17 at 20:28
  • `$_POST` in PHP contains everything that was sent, so dump it out? – Waxi Mar 10 '17 at 20:32
  • @AmericanSlime this might be what I need , I will try this ( Thank you ) – napi15 Mar 10 '17 at 20:38

0 Answers0