How can I call a web service from php
Use function curl:
curl
http://php.net/manual/en/book.curl.php
Assuming you are using a GET request to connect to a RESTful API:
$url = "http://the-api-you-want/?the-args=your-args&another-arg=another-arg"; $ch = curl_init(); // start CURL curl_setopt($ch, CURLOPT_URL, $url); // set your URL curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // get the response as a variable $json = curl_exec($ch); // connect and get your JSON response curl_close($ch);
Then you can use PHP json_decodeto answer if that is what you want to do.
json_decode
Another option would be to use the Drupal function drupal_http_request http://api.drupal.org/api/function/drupal_http_request/6
drupal_http_request
I would recommend you to be more specific in your Question. What type of web service do you mean?
Rest Webservices, Zend_Rest_Client, Zend Framework. , Zend Framework SOAP-.
Use curl or the Zend_Http_Client library from the Zend Framework (you don't need the whole Zend Framework to use the library). If the service you are calling sends a JSON response, you will have to parse it in PHP using json_decode .
Source: https://habr.com/ru/post/1742650/More articles:Problem with external loading SWF - flashC # Asynchronous Network IO and OutOfMemoryException - c #Is there any query in sqlite for selecting a substring? - sqliteDynamic content does not work when loading ajax - javascriptLaunch default browser - Windows - vb.netVim replaces reeds with double spaces - vimSelenium: могу ли я объединить несколько команд в одну команду, чтобы ссылаться на другие тесты без кодирования - seleniumGetting master data in insertion order - sortingroot domain redirection - SEO and other issues, you need a guide! - asp.netEmbedding an array of non-standard design objects in a C ++ class - c ++All Articles