Skip to content

Instantly share code, notes, and snippets.

View dineshrabara's full-sized avatar

Dinesh Rabara dineshrabara

  • Pune, India
View GitHub Profile
@dineshrabara
dineshrabara / Container.php
Created June 11, 2020 05:12 — forked from MustafaMagdi/Container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@dineshrabara
dineshrabara / sagepay.php
Created November 24, 2016 07:34
Reporting & Admin API for sagepayment
<?
$command = 'getTransactionList';
$vendor = 'vendorname';
$user = 'username';
$password = 'pwd';
$startdate = '01/05/2013 00:00:01';
$enddate = '31/05/2013 23:59:59';
$string = '<command>'.$command.'</command><vendor>'.$vendor.'</vendor><user>'.$user.'</user><startdate>'.$startdate.'</startdate><enddate>'.$enddate.'</enddate>';
@dineshrabara
dineshrabara / .htaccess
Last active August 29, 2015 14:21 — forked from siffring/.htaccess
# ----------------------------------------------------------------------
# Password protect staging server
# Use one .htaccess file across multiple environments
# (e.g. local, dev, staging, production)
# but only password protect a specific environment.
# ----------------------------------------------------------------------
SetEnvIf Host staging.domain.com passreq
AuthType Basic
AuthName "Password Required"
@dineshrabara
dineshrabara / File Transfer server to server
Last active August 29, 2015 14:07
File Transfer server to server
<?php
set_time_limit(0);
ini_set('memory_limit', '-1');
/* $str = file_get_contents("http://{siteurl}/project.zip",true);
file_put_contents(getcwd()."/project.zip", $str);
*/
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://{siteurl}/site.zip');
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);