Using webhook sending message to telegram from wordpress?

I want send a message to telegram whenever a form submitted. i am using gravity form plugin form. and it has the hook

add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 ); 

which will be call after form submitted. and i create a telegram bot and submit my url as webhook url base on instruction. here is my code:

$url = $path./sendmessage?chat_id=.$userID.text=.'messaginggggg';
$request = file_get_contents($url);

the problem is when i use the url in my browser it perfectly send notification to my bot , but from the site it returns error :

Warning: file_get_contents failed to open stream: Connection timed out in (my file path) line 20

line 20 is : $request = file_get_contents($url);

Topic wp-remote-request Wordpress

Category Web


I had an internet problem. i couldn't send a message from my site because of filterning probelm. Telegram is ban in my country then i should change the server to use Telegram.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.