My site

Hello, I have my website with a button, and when you click it, it’s supposed to send me a private message on Discord via a bot. When I click, a PHP file is executed and should send me a private message, but I get nothing. The page tells me that something isn’t working and that it can’t process this command. I have all the necessary files and folders, including the ‘vendor’ directory, etc.

Since you did not provide more info, my best guess is Telegram/Discord etc access are blocked on free hosting

4 Likes

What page? Your website? The API you are talking to?

6 Likes
  1. The page that opens when clicking the button.
  2. Yes, my website.
  3. I’m not very familiar with APIs, so I’m not sure if it’s the Discord API or not, sorry.

Can you share your website’s URL and perhaps the code you’re trying to use to send something to the Discord API, redacting any sensitive information?

If the Discord API is sending something to your website and expecting a response, this limitation may be affecting it:

5 Likes

Here is the address: http://test404.free.nf/

I can see send_dm.php is throwing an HTTP Error 500. Can you enable Display Errors?

4 Likes

I have enabled it, and I don’t quite understand what I should modify in /home/vol13_8/infinityfree.com/if0_35225456/htdocs/vendor/team-reflex/discord-php/src/Discord/Discord.php at line 341.

The error is quite descriptive:

Fatal error : DiscordPHP will not run on a webserver. Please use PHP CLI to run a DiscordPHP bot.

Your code seems to depend on DiscordPHP, which also mentions on its documentation that it is not suited for web servers:
https://discord-php.github.io/DiscordPHP/

CLI access is not offered with free hosting, so I don’t believe you can run this here, unfortunately.

5 Likes

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