Hello,
I am trying to make a curl request with PHP to a webhook of Home Assistant.
Making this request from reqbin.com does work and I can copy the PHP code from reqbin.com. But when I copy this to my own website, it doesn't work.
This is my code (from reqbin.com):
And this returns:
I don't know what I'm doing wrong, do you?
I am trying to make a curl request with PHP to a webhook of Home Assistant.
Making this request from reqbin.com does work and I can copy the PHP code from reqbin.com. But when I copy this to my own website, it doesn't work.
This is my code (from reqbin.com):
PHP:
$url = "https://XXXX.duckdns.org:8123/api/webhook/webhook_test";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Content-Type: application/x-www-form-urlencoded",
"Content-Length: 0",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
And this returns:
Code:
bool(false)
I don't know what I'm doing wrong, do you?