Curl Support

My website URL is: nuvoting.ml

What I’m seeing is: CURL won’t work on infinity free. It works on phpfiddle.org but not here. Is CURL supported anymore? 3 years ago it was, is it still supported?

Hi,
I believe CURL is still enabled for free hosting.

cURL is enabled and fully supported on free hosting. What problem do you experience exactly?

I am trying to use PHP to Post a message to a discord webhook.

The code, shown here. which I use, runs on phpfiddle.org but not here.

function postToDiscord($message)
{
$data = array(“content” => $message, “username” => “Webhooks”);
$curl = curl_init(“https://discordapp.com/api/webhooks/YOUR-WEBHOOK-URL-HERE”);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
return curl_exec($curl);
}

Hi,
It looks like API using CURL don’t work here.
Pls check the KB article:
https://infinityfree.net/support/javascript-error-using-api-or-mobile-android-app/

So if I understand you correctly, I can’t use PHP to Post a message to a discord webhook via CURL as I would be using an API while I am on the free plan?

Thank you for sharing the code. But what actually happens when you try to run the code? What is the error returned?

I put the code on http://nuvoting.ml/discord.php

No error is returned, but the code takes a long time to load but doesn’t actually do anything. It comes up on a blank page with the words “Message sent successfully”, like expected but the actual message doesn’t pop up in the discord channel.

It just checked it and it seems that Discord is being blocked on our servers. We were forced to disable access to many social services due to rampant abuse (e.g. spam bots). So you cannot access Discord’s API from your free hosting account.

Ok, thank you for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.