@@ -50,7 +50,7 @@ class Telegram
50
50
/**
51
51
* Constant for type animation.
52
52
*/
53
- const ANIMATION = 'animation ' ;
53
+ const ANIMATION = 'animation ' ;
54
54
/**
55
55
* Constant for type Document.
56
56
*/
@@ -72,23 +72,23 @@ class Telegram
72
72
private $ data = [];
73
73
private $ updates = [];
74
74
private $ log_errors ;
75
- private $ proxy ;
75
+ private $ proxy ;
76
76
77
77
/// Class constructor
78
78
79
79
/**
80
80
* Create a Telegram instance from the bot token
81
81
* \param $bot_token the bot token
82
- * \param $log_errors enable or disable the logging
83
- * \param $proxy array with the proxy configuration (url, port, type, auth)
82
+ * \param $log_errors enable or disable the logging
83
+ * \param $proxy array with the proxy configuration (url, port, type, auth)
84
84
* \return an instance of the class.
85
85
*/
86
- public function __construct ($ bot_token , $ log_errors = true , array $ proxy= array () )
86
+ public function __construct ($ bot_token , $ log_errors = true , array $ proxy = [] )
87
87
{
88
88
$ this ->bot_token = $ bot_token ;
89
89
$ this ->data = $ this ->getData ();
90
90
$ this ->log_errors = $ log_errors ;
91
- $ this ->proxy = $ proxy ;
91
+ $ this ->proxy = $ proxy ;
92
92
}
93
93
94
94
/// Do requests to Telegram Bot API
@@ -3041,13 +3041,13 @@ public function getUpdateType()
3041
3041
}
3042
3042
if (isset ($ update ['message ' ]['reply_to_message ' ])) {
3043
3043
return self ::REPLY ;
3044
- }
3044
+ }
3045
3045
if (isset ($ update ['message ' ]['animation ' ])) {
3046
3046
return self ::ANIMATION ;
3047
- }
3047
+ }
3048
3048
if (isset ($ update ['message ' ]['document ' ])) {
3049
3049
return self ::DOCUMENT ;
3050
- }
3050
+ }
3051
3051
if (isset ($ update ['channel_post ' ])) {
3052
3052
return self ::CHANNEL_POST ;
3053
3053
}
@@ -3069,34 +3069,33 @@ private function sendAPIRequest($url, array $content, $post = true)
3069
3069
curl_setopt ($ ch , CURLOPT_POST , 1 );
3070
3070
curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ content );
3071
3071
}
3072
- // echo "inside curl if";
3073
- if (!empty ($ this ->proxy )) {
3074
- // echo "inside proxy if";
3075
- if (array_key_exists ("type " , $ this ->proxy )) {
3076
- curl_setopt ($ ch , CURLOPT_PROXYTYPE , $ this ->proxy ["type " ]);
3077
- }
3078
-
3079
- if (array_key_exists ("auth " , $ this ->proxy )) {
3080
- curl_setopt ($ ch , CURLOPT_PROXYUSERPWD , $ this ->proxy ["auth " ]);
3081
- }
3082
-
3083
- if (array_key_exists ("url " , $ this ->proxy )) {
3084
- // echo "Proxy Url";
3085
- curl_setopt ($ ch , CURLOPT_PROXY , $ this ->proxy ["url " ]);
3086
- }
3087
-
3088
- if (array_key_exists ("port " , $ this ->proxy )) {
3089
- // echo "Proxy port";
3090
- curl_setopt ($ ch , CURLOPT_PROXYPORT , $ this ->proxy ["port " ]);
3091
- }
3092
-
3093
- }
3072
+ // echo "inside curl if";
3073
+ if (!empty ($ this ->proxy )) {
3074
+ // echo "inside proxy if";
3075
+ if (array_key_exists ('type ' , $ this ->proxy )) {
3076
+ curl_setopt ($ ch , CURLOPT_PROXYTYPE , $ this ->proxy ['type ' ]);
3077
+ }
3078
+
3079
+ if (array_key_exists ('auth ' , $ this ->proxy )) {
3080
+ curl_setopt ($ ch , CURLOPT_PROXYUSERPWD , $ this ->proxy ['auth ' ]);
3081
+ }
3082
+
3083
+ if (array_key_exists ('url ' , $ this ->proxy )) {
3084
+ // echo "Proxy Url";
3085
+ curl_setopt ($ ch , CURLOPT_PROXY , $ this ->proxy ['url ' ]);
3086
+ }
3087
+
3088
+ if (array_key_exists ('port ' , $ this ->proxy )) {
3089
+ // echo "Proxy port";
3090
+ curl_setopt ($ ch , CURLOPT_PROXYPORT , $ this ->proxy ['port ' ]);
3091
+ }
3092
+ }
3094
3093
curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , false );
3095
3094
$ result = curl_exec ($ ch );
3096
3095
if ($ result === false ) {
3097
3096
$ result = json_encode (['ok ' =>false , 'curl_error_code ' => curl_errno ($ ch ), 'curl_error ' => curl_error ($ ch )]);
3098
3097
}
3099
- echo $ result ;
3098
+ echo $ result ;
3100
3099
curl_close ($ ch );
3101
3100
if ($ this ->log_errors ) {
3102
3101
if (class_exists ('TelegramErrorLogger ' )) {
0 commit comments