user2167582
user2167582

Reputation: 6378

How to return a response via php

I'm writing a php api with methods wired together by php routing, such that

dev.myphp.com/user/[email protected]&password=d514

will return a json/xml response.

However, I do not know how to return this response, even if I use json_encode or xml_encode to conver the data string.

Do I just need to uniquely echo the JSON string out?

Upvotes: 0

Views: 2371

Answers (1)

Abhishek
Abhishek

Reputation: 1561

Always try to take data using POST method not GET , untill unless you don't find it less useful in caompare to POSt.

use simply

<?Php
--- php code 

return json_encode($resultdata);

?>

it would be enough.

Upvotes: 1

Related Questions