samedi 25 avril 2015

PHP post to WebAPI

Well, I know that he headline look simple, but i was looking 3 days for an example on how can you POST to webapi.

Till now i was using JQuery.POST to do my posts, but i need some php scrip to run and talk to my (C#) web API, And it seems impossible to find some examples or explain on how to do that.

Someone gave me then Code :

$response = file_get_contents('http://localhost:59040/api/Email/SendEmails');
$response = json_decode($response);
echo ($response);

But this one does nothing - Not even an error on how to go more into the problem.

I simpley need a php POST to webapi who gets 1 param(String) and return An ok answer or Error,

Thanks alot!

Good day.




Aucun commentaire:

Enregistrer un commentaire