نینس - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of نینس.php

  1. <?php
  2. define('API_KEY','1592538899:AAGy07OPzNf1X-mKCSlgUQhk2a7RH2Q9tfM');
  3.  
  4.  
  5. function bot($method,  $datas=[]){
  6.          $url = "https://api.telegram.org/bot".API_KEY."/".$method
  7.          $ch = curl_init();
  8.          curl_setopt($ch, option: CURLOPT_URL,$url);
  9.          curl_setopt($ch, option: CURLOPT_RETURNTRANSFER,$datas);
  10.          curl_setopt($ch, option: CURLOPT_POSTFIELDS,$datas);
  11.          $result  =   curl_exec($ch);
  12.          if  (curl_error($ch)){
  13.                 file_put_contents( filename: "curl_errors.txt" , curl_error$ch));
  14.                 }else{
  15.                        file_put_contents( filename: "curl_result.txt" ,$result) ;
  16.                        return  $result;
  17.                 }
  18. }
  19.  
  20. function  sendmessage( $chat_id , $text){
  21.          bot ( method: ' sendmessage ' ,[ ' chat_id ' =$chat_id, ' text ' ="asdasda " ] ) ;
  22.          }
File Description
  • نینس
  • PHP Code
  • 17 Feb-2021
  • 870 Bytes
You can Share it: