2017-10-14 5 views
-1

내가 그래서 내가 그것을이 URL을이File_get_contents 및 전보의 API (reply_markup)

$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/"}]]}'; 

및 했는가이

open me plz

처럼 버튼으로 메시지를 보낼 명령을 만들고 싶어

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를 사용할 때 하지 않는다

누군가 나를 도울 수 있습니까?

+0

CURL을 사용해 보셨습니까? PHP 버전은 무엇입니까? 서버에서 file_get_contents가 활성화되어 있는지 확인 했습니까? – wast

+0

nop, 지금까지 file_get_contents를 사용했기 때문에; php5.6; 예, 간단한 메시지를 보내려는 경우 작동합니다. – Dekus

+0

간단한 컬을 사용해 볼 수 있습니까? https://stackoverflow.com/questions/7794604/file-get-contents-not-working – wast

답변

0

나는 몇일 전에 동일한 문제가 있었는데 나는 대신 CURL을 시도해 보았습니다.

function curl_get_contents($url) { 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    $data = curl_exec($ch); 
    curl_close($ch); 
    return $data; 
}