PHP code example of nozell / webhookapi

1. Go to this page and download the library: Download nozell/webhookapi library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nozell / webhookapi example snippets



use CortexPE\DiscordWebhookAPI\Message;
use CortexPE\DiscordWebhookAPI\Webhook;
use CortexPE\DiscordWebhookAPI\Embed; // optional / opcional

$webHook = new Webhook("YOUR WEBHOOK URL");

$msg = new Message();
$msg->setUsername("USERNAME"); // optional / opcional
$msg->setAvatarURL("https://cortexpe.xyz/utils/kitsu.png"); // optional / opcional
$msg->setContent("INSERT TEXT HERE"); // optional. Max length 2000 characters / opcional. Máximo 2000 caracteres

$webHook->send($msg);

$embed = new Embed();
$embed->setTitle("Embed Title Here");
$embed->setDescription("A very awesome description / Una descripción muy genial");

$embed->setFooter("Footer text / Texto del pie de página");

$msg->addEmbed($embed);

$webHook = new Webhook("YOUR WEBHOOK URL");
$msg = new Message();
$msg->setUsername("USERNAME");
$msg->setAvatarURL("https://cortexpe.xyz/utils/kitsu.png");
$msg->setContent("INSERT TEXT HERE");

$embed = new Embed();
$embed->setTitle("EMBED 1");
$embed->setColor(0xFF0000);
$msg->addEmbed($embed);

$embed = new Embed();
$embed->setTitle("EMBED 2");
$embed->setColor(0x00FF00);
$embed->setAuthor("AUTHOR", "https://CortexPE.xyz", "https://cortexpe.xyz/utils/kitsu.png");
$embed->setDescription("Lorem ipsum dolor sit amet.");
$msg->addEmbed($embed);

$webHook->send($msg);