title: Sending photo from URL with Telegram Bot
body: <p>I made a telegram bot which sends photo upon request from URL using pyTelegramBotAPI wrapper. So I tried putting a dummy photo URL and test if the bot can send the image but it failed with the following error.</p>
  
  <p><code>telebot.apihelper.ApiException: sendPhoto failed. Returned result: &lt;Response [400]&gt;</code></p>
  
  <p>I'm not sure what the error is, but how can I send a photo from URL using Telegram Bot API correctly? Here is my code</p>
  
  <pre><code>import telebot
  import time
  import urllib
  from io import BytesIO
  from PIL import Image
  
  TOKEN = '&lt;token here&gt;'
  url='http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/e15/10919672_584633251672188_179950734_n.jpg'
  
  def listener(*messages):
      for m in messages:
          chatid = m.chat.id
          if m.content_type == 'text':
              text = m.text
              name = m.fromUser.first_name
              msgid = m.message_id
              if(text.startswith('/photo')):
                  img = BytesIO(urllib.request.urlopen(url).read())
                  tb.send_chat_action(chatid, 'upload_photo')
                  tb.send_photo(chatid, img, reply_to_message_id=msgid)
  
  
  tb = telebot.TeleBot(TOKEN)
  tb.get_update()  # cache exist message
  tb.set_update_listener(listener) #register listener
  tb.polling()
  while True:
      time.sleep(1)
  </code></pre>
  
  <p>I'm not sure whether I missed something though.</p>