Skip to content

Instantly share code, notes, and snippets.

@vikkey321
vikkey321 / specific.php
Created September 10, 2019 14:45
Creating your own IoT cloud from scratch using php, Mysql, ESP12E
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
//Creating Array for JSON response
$response = array();
// Include data base connect class
$filepath = realpath (dirname(__FILE__));
require_once($filepath."/db_connect.php");
// Connecting to database
@vikkey321
vikkey321 / read_all.php
Created September 10, 2019 14:45
Creating your own IoT cloud from scratch using php, Mysql, ESP12E
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
//Creating Array for JSON response
$response = array();
// Include data base connect class
$filepath = realpath (dirname(__FILE__));
require_once($filepath."/db_connect.php");
// Connecting to database
@vikkey321
vikkey321 / insert.php
Created September 10, 2019 14:44
Creating your own IoT cloud from scratch using php, Mysql, ESP12E
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
//Creating Array for JSON response
$response = array();
// Check if we got the field from the user
if (isset($_GET['temp']) && isset($_GET['hum'])) {
$temp = $_GET['temp'];
@vikkey321
vikkey321 / delete.php
Created September 10, 2019 14:43
Creating your own IoT cloud from scratch using php, Mysql, ESP12E
<?php
header('content-type: application/json; charset=utf-8');
header("access-control-allow-origin: *");
//Creating Array for JSON response
$response = array();
// Check if we got the field from the user
if (isset($_GET['id'])) {
@vikkey321
vikkey321 / db_connect.php
Created September 10, 2019 14:42
Creating your own IoT cloud from scratch using php, Mysql, ESP12E
<?php
class DB_CONNECT {
// Constructor
function __construct() {
// Trying to connect to the database
$this->connect();
}
// Destructor
@vikkey321
vikkey321 / dbconfig.php
Created September 10, 2019 14:35
Creating-your-own-IoT-cloud-from-scratch-using-php--Mysql--ESP12E
<?php
/****************************************************/
/************** Created by : Vivek Gupta ************/
/*************** www.vsgupta.in *************/
/*************** www.iotmonk.com *************/
/****************************************************/
define('DB_USER', "database user name"); // Your database user name
define('DB_PASSWORD', "database password"); // Your database password (mention your db password here)
define('DB_DATABASE', "database name"); // Your database name
define('DB_SERVER', "localhost"); // db server (Mostly will be 'local' host)