Senin, 06 April 2020

Telegram BOT


set webhook

https://api.telegram.org/bot{my_bot_token}/setWebhook?url={url_to_send_updates_to}

you should set code like this:

<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization');

$data = file_get_contents("php://input");
$data = json_decode($data,true);
$msg = (object) $data;
$f=print_r($msg,true);
print_r($msg);
file_put_contents("wh.txt",$f);
?>

<?php
session_start();
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
date_default_timezone_set('Asia/Jakarta');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization');
//REQUIRED TO REPLY MESSAGE
header("Content-Type: application/json");
$data = file_get_contents("php://input");
$data = json_decode($data,true);
$msg = (object) $data[message];
$coming = (object) $data;

$f=print_r($coming,true);
file_put_contents("wh.txt",$f);

$chat_id = $msg->chat[id];

$text = $msg->text;
$text=str_replace("@intec_sipadebot","",$text);
$message=strtoupper($text);

$inlinekeyboard[] = ['text' => "Kirim Nomor"'url' => '', callback_data => "call_back_data"'request_contact' => true];
$inlinekeyboard[] = ['text' => "Kirim Lokasi"'url' => '', callback_data => "call_back_data"];

$keyboard = ['inline_keyboard' => [$inlinekeyboard], 'one_time_keyboard' => true,'resize_keyboard' => true];
$parameters = array('chat_id' => $chat_id, "text" => "Pilih apa yang anda bagikan");
$parameters["method"] = "sendMessage";
$parameters["reply_markup"] = json_encode($keyboard, true);
echo json_encode($parameters);
/*









Sabtu, 04 April 2020

Left Join With Select


select sia_dasis.*,tax from sia_dasis left join (select sum(tax) as tax,b from sia_bill_list where owner='$owner->owner' group by b) tagih on sia_dasis.b = tagih.b where sia_dasis.owner='$owner->owner' and sia_dasis.b like '$a->b%' and sia_dasis.c like '%$a->c%' order by $urut ASC limit 50




SELECT b,c,d,f,g,h,nokk,kk

from des_daduk

left join

(select d as nokk,c as kk from des_daduk where q='1') tbkk

on des_daduk.d=tbkk.nokk

where des_daduk.c like '%masturi%'


Foto Propades