Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

asya's avatar
Level 1

Curl Call

How else to make a curl call to external API apart from guzzle

0 likes
4 replies
ejdelmonico's avatar

A gift...

class Curl
{
    public function post($url, $payload)
    {
        $ch = curl_init($url);

        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $response = curl_exec($ch);

        curl_close($ch);

        return $response;
    }
}
2 likes
asya's avatar
Level 1

Actually I wasnt getting how to make post requests from Guzzle

Please or to participate in this conversation.