Advertisement
MyZik

Untitled

May 26th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. if (preg_match('/(^Вики\s)(.*?$)/s', $text, $matches)) {
  2.     $request = file_get_contents('https://ru.wikipedia.org/w/api.php?action=opensearch&search={$matches[2]}&limit=1&format=json');
  3.     $response= json_decode($request, true);
  4.    
  5.     $quoteText = $response;          
  6.     Request::sendMessage([
  7.         'chat_id' => $chat_id,
  8.         'reply_to_message_id' => $message->getMessageId(),
  9.         'text' => var_export($quote, true),
  10.     ]);
  11.  
  12.     exit();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement