Answer the question
In order to leave comments, you need to log in
How to find and cut text?
Please tell me how to extract the text from here. The text is selected ->
The text can be completely different, you need to cut out everything that is in the " " that comes after the "text":
{"ok":true,"result":[{"update_id":125804848, "message":{ "message_id":28,"from":{"id":178282468,"first_name":"Ismar","last_name":"Suleymanov"},
"chat":{"id":178282468,"first_name":" Ismar","last_name":"Suleymanov","type":"private"},"date":1447495291,"text":" asdasd "}},{"update_id":125804849, "message":{"message_id ":29,"from":{"
Answer the question
In order to leave comments, you need to log in
Here's the code for you to see...
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.telegram.org/bot155786728:AAHmcineLW6WFxBs6XuH0liWYuM0W1lqqKQ/getUpdates');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_POST, true);
$code = json_decode(curl_exec($curl));
curl_close($curl);
print_r($code);
// вывод всех записей...
foreach($code->result as $item)
{
echo $item->message->text.'<br>';
}
// вывод определенной записи по порядковому номеру...
echo $code->result[0]->message->text;
?>
$json='{"ok":true,"result":[{"update_id":125804848, "message":{"message_id":28,"from":{"id":178282468,"first_name":"Ismar","last_name":"Suleymanov"},
"chat":{"id":178282468,"first_name":"Ismar","last_name":"Suleymanov","type":"private"},"date":1447495291,"text":"asdasd"}},{"update_id":125804849, "message":{"message_id":29,"from":{"id":178282468,"first_name":"Ismar","last_name":"Suleymanov"},
}}]}';
var_dump(json_decode($json));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question