Skip to content

Instantly share code, notes, and snippets.

View Porrapat's full-sized avatar

Porrapat Petchdamrongskul Porrapat

View GitHub Profile
@Porrapat
Porrapat / mail-test.php
Created November 6, 2015 08:24 — forked from Dreyer/mail-test.php
Quick & Dirty PHP Mail Test Script
<?php
/*
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED!
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = 'webmaster@example.com';
# Simple Check Website (With Send Slack Message to Channel)
# How to use
# ======================================
# chmod -R 777 checkwebsite.sh
# ./checkwebsite.sh
# Can install as crontab and output to log file. Something like
# * * * * * bash ./checkwebsite.sh >> /www/checkwebsite/html/checkwebsite.log
# To Do More
# Login To Laravel Web App And Scrape Some Data : Customize for Laravel Web App
# requirement : you must install HTML-XML-utils first by
# sudo apt-get install html-xml-utils
# provide your information here
url=https://xxx.xxx.com
username=YOUR_USERNAME_HERE
password=YOUR_PASSWORD_HERE
result=$(curl -c form-cookie.txt -sL "$url/login")
# Curl to list of website and get it's title html tag
# Useful for checking code quality of many websites.
# requirement : you must install HTML-XML-utils first by
# sudo apt-get install html-xml-utils
now=$(date)
URLs=(
"google.com"
# Link on bank website using gotted
# Please provide SESSIONEASY variable and cookie_file you previously captured
# chmod -R 777 login_scb_using_got_info.sh
# ./
statement_url=https://www.scbeasy.com/online/easynet/page/acc/acc_mpg.aspx
SESSIONEASY=
cookie_file=
echo "SESSIONEASY IS : $SESSIONEASY"
# ============ Login SCB ========================
# To Use provide your username and password
# chmod -R 777 login_scb.sh
# ./login_scb.sh
# Please provide your username and password on https://www.scbeasy.com/
username=
password=
# Please Specify Your cookie file (Any blank text file is OK.)
# ============ Login K-Bank ========================
# To Use provide your username and password
# chmod -R 777 login_k-bank.sh
# ./login_k-bank.sh
# Please provide your username and password here
# This is not the best choice to use this script. because your password is saved on your machine and transfer through script
# Please consider K-Bank Open API instead https://apiportal.kasikornbank.com/open-api/
username=
password=
# How to use
# Make sure you install curl. By running curl -v to test it.
# Provide your Gmail username and password and who you need to send email to.
# For password it is not your Gmail password but it is App passwords https://support.google.com/mail/answer/185833. Please go to your Gmail account setting and create it.
# chmod -R 777 send-email-gmail-thai.com
# ./send-email-gmail-thai.com
# Your Gmail username (email) (Required)
SENDER_GMAIL_USERNAME=
# Your App password (Required)
# How to use
# Make sure you install curl. By running curl -v to test it.
# Provide your Gmail username and password and who you need to send email to.
# For password it is not your Gmail password but it is App passwords https://support.google.com/mail/answer/185833. Please go to your Gmail account setting and create it.
# chmod -R 777 send-email-gmail.com
# ./send-email-gmail.com
# Your Gmail username (email) (Required)
SENDER_GMAIL_USERNAME=
# Your App password (Required)
# To use : add your slack oauth access api token
SLACK_API_OAUTH_ACCESS_TOKEN=
# Provide your slack channel
SLACK_CHANNEL=
# Provide your text
TEXT=
curl -s -X POST -d "token=$SLACK_API_OAUTH_ACCESS_TOKEN&channel=$SLACK_CHANNEL&text=$TEXT&pretty=1" "https://slack.com/api/chat.postMessage" > /dev/null