cURL error
wblaircox opened this issue · 10 comments
Hi, I'm having the following error;
Fatal error: Uncaught exception 'Exception' with message ' in C:\wamp\www\bot\DiscordWebhooks\Client.php on line 73
Exception: cURL error (3): URL using bad/illegal format or missing URL in C:\wamp\www\bot\DiscordWebhooks\Client.php on line 73
I've done some troubleshooting on my end to see if perhaps WAMP is blocking cURL, but all looks as it should. Any suggestions? Thanks.
Also I'd need to see how you are using the class because the constructor wants a url. I didn't put any extensive error checking in yet since I didn't need it.
Fresh install of WAMP. Switched PHP to 7.0.29, 7.1.16 and 7.2.4. Using your latest commit of discord-webhooks. Same error.
Example of the URL I'm getting from Discord;
https: //discordapp.com/api/webhooks/44223324552327136384/B_5n596Xjog-djmsopeXITEmfXeV8O7fjhskeoyNyCbgBdaa71YZsns8khpeLdmcvkG3PnIX
I began with your example so I could test and build off it.
<?php
require_once 'DiscordWebhooks\Client.php';
require_once 'DiscordWebhooks\Embed.php';
require_once "Careerjet_API.php";
use \DiscordWebhooks\Client;
use \DiscordWebhooks\Embed;
$webhook = new Client('https: //discordapp.com/api/webhooks/44223324552327136384/B_5n596Xjog-djmsopeXITEmfXeV8O7fjhskeoyNyCbgBdaa71YZsns8khpeLdmcvkG3PnIX
');
$embed = new Embed();
$embed->description('This is an embed');
$webhook->username('Bot')->message('Hello, Human!')->embed($embed)->send();
...
I modified it, it's fake. Thanks, most appreciated.
$webhook = new Client('https: //discordapp.com/api/webhooks/44223324552327136384/B_5n596Xjog-djmsopeXITEmfXeV8O7fjhskeoyNyCbgBdaa71YZsns8khpeLdmcvkG3PnIX
');
Can you check to make sure you don't have a space after the colon and before the double forward slashes? That would be an invalid URL.
ah, well that certainly was one issue. Now I get the following (using the real webhook URL);
Fatal error: Uncaught Exception: cURL error (60): Peer certificate cannot be authenticated with given CA certificates in C:\wamp\www\bot\DiscordWebhooks\Client.php on line 73
Exception: cURL error (60): Peer certificate cannot be authenticated with given CA certificates in C:\wamp\www\bot\DiscordWebhooks\Client.php on line 73
--
Suspect that issue is on my end...
Cheers, thanks for pointing out my blunder!