PHP Classes

File: examples/form.php

Recommend this page to a friend!
  Classes of Saeb Khanzadeh   Gap SDP API   examples/form.php   Download  
File: examples/form.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Gap SDP API
Send messages with the Gap instant messenger
Author: By
Last change:
Date: 6 years ago
Size: 717 bytes
 

Contents

Class file image Download
<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

use
Gap\SDP\Api;

$token = {HERE YOUR TOKEN};

$gm = new Api($token);

$chat_id = {HERE CHAT ID};

$form = [
  [
"name" => "name", "type" => "text", "label" => "Name"],
  [
"name" => "married", "type" => "radio", "options" => [["y" => "Yes"], ["n" => "No"]], "label" => "Married"],
  [
"name" => "city", "type" => "select", "options" => [["mah" => "Mashhad"], ["teh" => "Tehran"]], "label" => "City"],
  [
"name" => "address", "type" => "textarea", "label" => "Address"],
  [
"name" => "agree", "type" => "checkbox", "label" => "I agree"],
  [
"type" => "submit", "label" => "Save"],
];

// send text
$gm->sendText($chat_id, 'Hello world', null, null, $form);