Skip to content

Releases: DivanDesign/EvolutionCMS.snippets.ddMakeHttpRequest

Version 2.4

28 Nov 11:51

Choose a tag to compare

🇬🇧

  • + Created detailed error logging for CURL errors and HTTP error responses (4xx, 5xx), including URL, HTTP code, CURL error code and message.
  • * Parameters:
    • + isDebug: The new optional parameter created. Allows to log all requests (including successful ones), not only errors. Useful for debugging and monitoring.
    • * All request parameters are now grouped into requester object and several renamed (backward compatibility preserved, but old parameters are not recommended to use):
      • * postDatarequester->data.
      • * sendRawPostDatarequester->isRawDataEnabled.
      • * useCookierequester->isCookieUsed.
      • * urlrequester->url.
      • * methodrequester->method.
      • * headersrequester->headers.
      • * userAgentrequester->userAgent.
      • * timeoutrequester->timeout.
      • * proxyrequester->proxy.
    • + requester->method → Valid values → put, patch, delete: The new supported methods.
    • + dataProcessor: The new optional parameter. Allows to process and validate response data with configurable success/failure checking, see README → Parameters, README → Examples.
    • + outputter: The new optional parameter. Allows to return response data, metadata, or both; and to convert the result to a required format. Metadata contains the following properties:
      • + 'isSuccess' — Whether the request was successful (CURL, HTTP code, and data validation).
      • + 'isCurlSuccess' — Whether CURL execution was successful.
      • + 'isHttpCodeSuccess' — Whether HTTP response code is not an error (< 400 or >= 600).
      • + 'isDataValid' — Whether response data is valid.
      • + 'effectiveUrl' — Effective URL.
      • + 'curlErrorCode' — CURL error code.
      • + 'message' — Message text. Contains CURL error message if CURL failed, or message from response data if dataProcessor->messagePropName is set.
      • + 'code' — HTTP code.
  • * Attention! PHP >= 7.4 is required (not tested with older versions).
  • * Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.63 is required.

🇷🇺

  • + Добавлено подробное логирование ошибок CURL и HTTP (4xx, 5xx), включая URL, HTTP код, код ошибки CURL и сообщение.
  • * Параметры:
    • + isDebug: Новый необязательный параметр. Позволяет логировать все запросы (включая успешные), не только ошибки. Полезен для отладки и мониторинга.
    • * Все параметры запроса теперь сгруппированы в объект requester и несколько переименованы (обратная совместимость сохранена, но старое не рекомендуется использовать):
      • * postDatarequester->data.
      • * sendRawPostDatarequester->isRawDataEnabled.
      • * useCookierequester->isCookieUsed.
      • * urlrequester->url.
      • * methodrequester->method.
      • * headersrequester->headers.
      • * userAgentrequester->userAgent.
      • * timeoutrequester->timeout.
      • * proxyrequester->proxy.
    • + requester->method → Допустимые значения → put, patch, delete: Новые поддерживаемые методы.
    • + dataProcessor: Новый необязательный параметр. Позволяет обрабатывать и валидировать данные ответа с настраиваемой проверкой успешности/неуспешности, см. README → Параметры, README → Примеры.
    • + outputter: Новый необязательный параметр. Позволяет возвращать данные ответа, метаданные, или оба; и преобразовывать результат в требуемый формат. Метаданные содержат следующие свойства:
      • + 'isSuccess' — Был ли запрос успешным (CURL, HTTP код, и валидация данных).
      • + 'isCurlSuccess' — Был ли успешен выполнение CURL.
      • + 'isHttpCodeSuccess' — Был ли HTTP код не ошибкой (< 400 или >= 600).
      • + 'isDataValid' — Были ли данные валидны.
      • + 'effectiveUrl' — Эффективный URL.
      • + 'curlErrorCode' — Код ошибки CURL.
      • + 'message' — Текст сообщения. Содержит сообщение об ошибке CURL, если CURL не выполнился, или сообщение из данных ответа, если dataProcessor->messagePropName установлено.
      • + 'code' — HTTP код.
  • * Внимание! Требуется PHP >= 7.4 (не тестировалось с более старыми версиями).
  • * Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.63.

Version 2.3.2

25 May 03:26

Choose a tag to compare

  • * Parameters → postData: Multidimensional PHP arrays and objects are also supported.

Version 2.3.1

17 Apr 09:04

Choose a tag to compare

  • * \ddMakeHttpRequest\Snippet::run: Fixed checking of a non-existent array element.

Version 2.3

13 Apr 09:49

Choose a tag to compare

  • + \ddMakeHttpRequest\Snippet::run: Improved “manual” redirection.

Version 2.2

01 Apr 21:56

Choose a tag to compare

  • * Attention! PHP >= 5.6 is required.
  • * Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.48.2 is required.
  • + Parameters → postData: Can also be set as HJSON or a native PHP object.
  • + Parameters → headers: Can also be set as HJSON.
  • + You can just call \DDTools\Snippet::runSnippet to run the snippet without DB and eval (see README → Examples).
  • + \ddMakeHttpRequest\Snippet: The new class. All snippet code was moved here.
  • + README:
    • + Links.
    • + Documentation → Parameters description → postData, headers → Valid values: Text improvements.
    • + Style improvements.
  • + Composer.json:
    • + homepage.
    • + support.
    • + authors.

Version 2.1

01 Apr 21:55

Choose a tag to compare

  • + Cookie can be used (see the useCookie parameter).

Version 2.0

01 Apr 21:55

Choose a tag to compare

  • * Attention! Backward compatibility is broken. If you want send raw JSON in postData you must set sendRawPostData equal to 1.
  • + postData can be set as a JSON object.
  • + headers can be set as a JSON array.
  • + Added an ability to send raw postData (see sendRawPostData).

Version 1.0

01 Apr 21:54

Choose a tag to compare

  • + The first release.