Q&A

I tried to run send broadcasting API with help of line paltform and got an error timeout failed to connect api.line.me poert:443

#my code in php using cURL

$access_token = 'SAXS7vXwTXMtC31PKEcyNQPxmDwoabep5Flu0/OvMRKqVEAKYIf0b0JgxWtCpd9G4Gu0RaMM2sO7zgjXZTiO43lf4FtdWbHD8GWB4SM8HrKEpoxFPEYwvhPhEw/3W5WFoUyPnKkc/PVT6RarnA1/XAdB04t89/1O/w1cDnyilFU=';

$content = ' { "type":"text", "text":"Hello, world1" } ';

$url = 'https://api.line.me/v2/bot/message/broadcast';

$retryKey = null;

$headers = ["Content-Type:application/json; charset=utf-8", "Authorization:Bearer " . $access_token];

$data = array('messages' => $content, 'notificationDisabled' => true);

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

curl_setopt($ch, CURLOPT_TIMEOUT, 0);

curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

var_dump($result);

#output bool(false) Failed to connect to api.line.me port 443: Timed out

What can I do Please help me figure out this problem

  • 0
  • 2
  • 274
  • twitter facebook

Hi, you should not show your access token. It's your secret. Please edit your question and hide it.

  • 0

It's probably a network issue on your side. I tried broadcast with my token and got response within a second. I would suggest looking into firewalls and network filters that could be blocking requests.

to check your environment, what happens when you use curl -X GET google.com and curl -X GET -H 'Authorization: Bearer {your access token}' https://api.line.me/v2/bot/info ? Do you get a successful response?

  • 0
Are you sure? question.vm