Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
<?php

namespace PhpOffice\PhpSpreadsheet\Calculation;

< use PhpOffice\PhpSpreadsheet\Settings; < use Psr\Http\Client\ClientExceptionInterface; <
> /** > * @deprecated 1.18.0 > */
class Web { /** * WEBSERVICE. * * Returns data from a web service on the Internet or Intranet. * * Excel Function: * Webservice(url) *
> * @see Web\Service::webService() * @return string the output resulting from a call to the webservice > * Use the webService() method in the Web\Service class instead */ > *
public static function WEBSERVICE(string $url) {
< $url = trim($url); < if (strlen($url) > 2048) { < return Functions::VALUE(); // Invalid URL length < } < < if (!preg_match('/^http[s]?:\/\//', $url)) { < return Functions::VALUE(); // Invalid protocol < } < < // Get results from the the webservice < $client = Settings::getHttpClient(); < $requestFactory = Settings::getRequestFactory(); < $request = $requestFactory->createRequest('GET', $url); < < try { < $response = $client->sendRequest($request); < } catch (ClientExceptionInterface $e) { < return Functions::VALUE(); // cURL error < } < < if ($response->getStatusCode() != 200) { < return Functions::VALUE(); // cURL error < } < < $output = $response->getBody()->getContents(); < if (strlen($output) > 32767) { < return Functions::VALUE(); // Output not a string or too long < } < < return $output;
> return Web\Service::webService($url);
} }