Skip to content

Instantly share code, notes, and snippets.

@eliagbenu
eliagbenu / single.php
Created January 26, 2019 22:12
Fetch a single resource
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / update.php
Created January 26, 2019 22:13
Update a single record
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / insert.php
Created January 26, 2019 22:14
Save a single record
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / website-monitor-example.py
Created February 27, 2019 07:32 — forked from ogrigas/website-monitor-example.py
Example Python script that pings a website and sends email alert in case it's unreachable
from urllib2 import urlopen
def send_alert():
from smtplib import SMTP
from email.mime.text import MIMEText
msg = MIMEText('nuf said')
msg['Subject'] = 'inventi.lt is unreachable'
msg['From'] = '[email protected]'