Plugin Directory

Changeset 1588825


Ignore:
Timestamp:
02/04/2017 10:14:44 AM (9 years ago)
Author:
websima
Message:

Channeller 1.5.4 - Change file_get_contents to CURL

Location:
channeller-telegram-channel-administrator/trunk
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • channeller-telegram-channel-administrator/trunk/channeller.php

    r1570682 r1588825  
    22/**
    33 * @package Websima Telegram Channel
    4  * @version 1.5.3
     4 * @version 1.5.4
    55 */
    66/*
     
    99Description: Send Text, URL, Photo, Video and Audio from Wordpress to Telegram Channel using Telegram bot API.
    1010Author: Websima Creative Agency
    11 Version: 1.5.3
     11Version: 1.5.4
    1212Author URI: http://websima.com
    1313*/
  • channeller-telegram-channel-administrator/trunk/includes/ch-send-functions.php

    r1571026 r1588825  
    128128    $chatter = get_site_option( $chat_id );
    129129    $caption = truncate_channeller ($caption , 200);
    130     // $fields = array(
    131         // 'chat_id' => $chatter,
    132          // // make sure you do NOT forget @ sign
    133          // 'photo' =>
    134           // '@'            . $photo
    135           // . ';filename=' . $photo,
    136         // 'caption' => $caption
    137     // );
     130
     131
    138132 
    139         $caption = urlencode($caption);
     133        //$caption = urlencode($caption);
     134
    140135        if ($keyboard == 'no') {
    141     $url = 'https://api.telegram.org/bot'.$token.'/sendPhoto?chat_id='.$chatter.'&photo='.$photo.'&caption='.$caption.'&parse_mode=HTML';
    142         } else {
     136$params=[
     137    'chat_id'=>$chatter,
     138    'photo'=>$photo,
     139    'caption'=>$caption,
     140    'parse_mode'=>'HTML',
     141];     
     142} else {
    143143            $replyMarkup = array('inline_keyboard' => $keyboard);
    144144            $encodedMarkup = json_encode($replyMarkup);
    145     $url = 'https://api.telegram.org/bot'.$token.'/sendPhoto?chat_id='.$chatter.'&photo='.$photo.'&caption='.$caption.'&parse_mode=HTML&reply_markup='.$encodedMarkup;
     145$params=[
     146    'chat_id'=>$chatter,
     147    'photo'=>$photo,
     148    'caption'=>$caption,
     149    'parse_mode'=>'HTML',
     150'reply_markup'=>$encodedMarkup,
     151];
    146152        }
    147     $update = file_get_contents($url, false);
     153$url="https://api.telegram.org/bot".$token;
     154$ch = curl_init($url. '/sendPhoto');
     155curl_setopt($ch, CURLOPT_HEADER, false);
     156curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     157curl_setopt($ch, CURLOPT_POST, 1);
     158curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
     159curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     160$update = curl_exec($ch);
     161curl_close($ch);
    148162    $result = json_decode ($update);
    149163    if ($result->ok == 1) {
     
    163177    $message = truncate_channeller ($message , 4096);
    164178    if ($token) {
    165         $message = urlencode($message);
     179        //$message = urlencode($message);
    166180        if ($keyboard == 'no') {
    167     $url = 'https://api.telegram.org/bot'.$token.'/sendMessage?chat_id='.$user_id.'&text='.$message.'&parse_mode=HTML';         
    168         } else {
     181$params=[
     182    'chat_id'=>$user_id,
     183    'text'=>$message,
     184    'parse_mode'=>'HTML',
     185];      } else {
    169186            $replyMarkup = array('inline_keyboard' => $keyboard);
    170187            $encodedMarkup = json_encode($replyMarkup);
    171     $url = 'https://api.telegram.org/bot'.$token.'/sendMessage?chat_id='.$user_id.'&text='.$message.'&parse_mode=HTML&reply_markup='.$encodedMarkup;
     188$params=[
     189    'chat_id'=>$user_id,
     190    'text'=>$message,
     191'parse_mode'=>'HTML',
     192'reply_markup'=>$encodedMarkup,
     193];
    172194        }
    173     $update = file_get_contents($url, false);
     195$url="https://api.telegram.org/bot".$token;
     196$ch = curl_init($url. '/sendMessage');
     197curl_setopt($ch, CURLOPT_HEADER, false);
     198curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     199curl_setopt($ch, CURLOPT_POST, 1);
     200curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
     201curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     202$update = curl_exec($ch);
     203curl_close($ch);
    174204    $result = json_decode($update);
    175205    if ($result->ok == 1) {
  • channeller-telegram-channel-administrator/trunk/readme.txt

    r1570682 r1588825  
    55Requires at least: 3.0.1
    66Tested up to: 4.7
    7 Stable tag: 1.5.3
     7Stable tag: 1.5.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8181
    8282== Changelog ==
     83= 1.5.4 =
     84change file_get_contents function to CURL
     85
    8386= 1.5.2 =
    8487Future Posts Support for channels
Note: See TracChangeset for help on using the changeset viewer.