File_get_contents和Telegram API(reply_markup)

时间:2017-10-14 19:15:54

标签: php api telegram

我想创建一个发送带有按钮的消息的命令

open me plz

所以我做了这个

$url = "https://api.telegram.org/" . $token . "/sendMessage?chat_id=" . $message_chat_id . "&text=" . urlencode($message_text) . '&reply_markup={"inline_keyboard":[[{"text":"Visualizza spoiler!","url":"http://google.com/"}]]}';

并制作此网址

https://api.telegram.org/censored/sendMessage?chat_id=censored&text=%2Fspoiler+ciao&reply_markup={"inline_keyboard":[[{"text":"Visualizza spoiler!","url":"http://google.com/"}]]}

当我在浏览器中使用此URL时它可以工作但是当我使用file_get_contents时它不会

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

前几天我遇到了同样的问题,我只是尝试了CURL而且工作正常。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<aside> 

    <div> 
      <ul>
          <li class="asideMenu"> <a href="#">Click to Open 1 </a>
               <p class="subAside"> Uneasy barton seeing remark happen his has. Am possible offering at contempt mr distance stronger an. </p> 
        </li>
          <li class="asideMenu"><a href="#"> Click to Open 2 </a> 
               <p class="subAside"> Uneasy barton seeing remark happen his has. Am possible offering at contempt mr distance stronger an. </p>
        </li>

          <li class="asideMenu"><a href="#"> Click to open 3 </a>
               <p class="subAside"> Uneasy barton seeing remark happen his has. Am possible offering at contempt mr distance stronger an. </p>
        </li>
      </ul>    


    </div>

</aside>