Skip to content

Instantly share code, notes, and snippets.

View surferxo3's full-sized avatar

Mohammad Sharaf Ali surferxo3

View GitHub Profile
@surferxo3
surferxo3 / curl.php
Last active May 15, 2024 09:12
Script to demonstrate how to extract Header and Body from the Curl response in PHP.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// SETTINGS
ini_set('max_execution_time', 0);
@surferxo3
surferxo3 / slim_demo.php
Last active July 26, 2020 11:44
Do some work Before and After the Slim route is executed. Demonstrates the use of Middleware in Slim instead of Hooks.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
@surferxo3
surferxo3 / sendpush.php
Last active October 30, 2016 18:15
Script to send iOS and Android Push Notifications.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
#function to send push notification
function sendPush($deviceToken, $body, $type, $params) {
@surferxo3
surferxo3 / MEvvnt.php
Last active October 30, 2016 17:47
A class to consume Evvnt API. Demonstrates the use of HTTP Basic Authentication.
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to consume Evvnt Api. Documentation: https://api.sandbox.evvnt.com/
* Dated: 30-10-2016
*/
namespace MSharaf;
@surferxo3
surferxo3 / MEmarsys.php
Last active October 30, 2016 17:40
A class to consume Emarsys API. Demonstrates the use of Web Services Security (WS-Security, WSS).
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to consume Emarsys Api. Documentation: http://documentation.emarsys.com/resource/developers/endpoints/
* Dated: 30-10-2016
*/
namespace MSharaf;
@surferxo3
surferxo3 / gold_silver_rates.php
Last active March 17, 2025 11:50
Gold and Silver Rates API to fetch updated rates with their respective currency and price.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 2.0
*
* Changes from Version 1.0:
* - Updated to use a new API endpoint that returns JSON data instead of plain text
* - Replaced file_get_contents with cURL for improved error handling and performance
@surferxo3
surferxo3 / notorm_demo.php
Last active July 26, 2020 11:45
NotORM demo of printing sql queries, handling notorm objects, and casting from objects to associative arrays in NotORM framework.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// LIBRARIES
require_once 'db/NotORM.php';
@surferxo3
surferxo3 / export.php
Last active October 30, 2016 18:17
Script to export data from MySQL in Excel.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
function exportToExcel($host, $user, $pass, $db, $query) {
$conn = mysql_connect($host, $user, $pass);
@surferxo3
surferxo3 / equivalence.php
Last active October 30, 2016 18:18
Script to calculate O and A levels Equivalence.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
##################### CONSTANTS #####################
// grade equivalence constants
@surferxo3
surferxo3 / MTracker.php
Last active October 30, 2016 17:32
A class to track campaign and visitors source via session.
<?php
/*
* Developer: Mohammad Sharaf Ali
* Version: 1.0
* Description: Class to track visitor registration source
* Dated: 23-04-2016
*/
namespace MSharaf;