Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2. $access_token = '';
  3. $api = 'https://api.telegram.org/bot' . $access_token;
  4. function sendPhotoId($chat_id, $file) {
  5.     $target_url = $GLOBALS['api'] . '/sendphoto';
  6.     $post = array(
  7.         'chat_id'   => $chat_id,
  8.         'photo'     => $file,
  9.     );
  10.  
  11.     $ch = curl_init();
  12.     curl_setopt($ch, CURLOPT_URL,$target_url);
  13.     curl_setopt($ch, CURLOPT_POST,1);
  14.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  15.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  16.     $result=curl_exec ($ch);
  17.     curl_close ($ch);
  18.     echo $result;
  19.     return json_decode($result);
  20. }
  21. sendPhotoId(119416836, 'AgADBAADxgM2G9AeZAdbakWTRpBQMFZWoBkABNTKxG8eq8f1P3sAAgI');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement