Skip to content

Improving error handling in the sendPostRequest method #95

@RobinTheHood

Description

@RobinTheHood

In the sendPostRequest method, file_get_contents() is currently used to send an HTTP POST request to a specific URL and return the results. However, error messages are suppressed using the "@" operator, which is undesirable as it prevents potential errors from being detected.

Therefore, I propose replacing the file_get_contents() call with cURL to enable better error handling and exception handling. The new implementation would use CURLOPT_POST to ensure that the request is sent as an HTTP POST request and CURLOPT_RETURNTRANSFER to ensure that the response is returned as a string. This would give us more control over the request and enable more precise error handling.

I believe that this change would contribute to improved robustness and reliability of the sendPostRequest method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions