-1

there is a web service with end points .( get and post developed by back end developer ) .web service is already hosted in Azure .i want to make a site which can communicate with the web service. how can i call those methods using PHP ? or JavaScript ? how to make a connection between web site and web service .

senura
  • 21
  • 1
  • 5
  • Welcome to StackOverflow. Please provide some code you have tried and problems you are actually facing. – Arcesilas May 22 '16 at 21:05

1 Answers1

2

I'll forgive you for the basic nature (and details) in your question but refrain from attempting to build this for you. Instead I'll point you to some basic concepts and hope further digging on your part will help.

Assuming the API endpoints are public or if not, that you have access to authentication credentials to access them, then it may be as simple as using an AJAX call to the endpoint.

E.g. assuming the endpoint is located at: https://220.10.11.123:8080/api/v1/getstuff and your app / site is already authenticated (or you don't need authentication because the app / site is hosted within the same network) and assuming that endpoint returns JSON, you could call it using AJAX directly from JavaScript and iterate over the JSON object, printing out values or whatever.

Or you could call it from PHP using curl (See curl_exec() and related functions on php.net). There are plenty of libraries and frameworks that have already solved this problem, as well as error handling, logging, testing etc so I really don't think I can help you much more at this point, just encourage you to have a crack at it to start with.

Having said that,once you've had a go calling your web-service with JS or PHP and used AJAX or curl and you have problems, then SO is the place to come for help.

Good luck :-)

theruss
  • 1,690
  • 1
  • 12
  • 18