Skip to content

Instantly share code, notes, and snippets.

View thiagomarini's full-sized avatar

Thiago Marini thiagomarini

View GitHub Profile
@thiagomarini
thiagomarini / pre_spaghetti.php
Created December 6, 2018 10:48
Weengs Pre Spaghetti Exaplme
<?php
// include environment related files
include_once '../inc/env.inc.php';
// will return JSON response
header('Content-type: application/json');
WEApplication::serviceAvailabilityCheck();
$secretDev = isset($_POST['secret_dev']) ? $_POST['secret_dev'] : '';
@thiagomarini
thiagomarini / bref.php
Last active January 4, 2019 15:07
Handling SQS events example
<?php
define('LARAVEL_START', microtime(true));
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
// Laravel does not create that directory automatically so we have to create it
// You can remove this if you do not use views in your application (e.g. for an API)
@thiagomarini
thiagomarini / index.php
Last active August 7, 2021 16:34
Plain PHP Curl proxy script example for json APIs. I tried using Apache mod_proxy for that but it was returning 301 only on curl, on guzzle it was fine.
<?php
// Needs to be used with a .htaccess file pointing all requests to it
$uri = $_SERVER['REQUEST_URI'];
$queryString = http_build_query($_GET);
$payload = file_get_contents('php://input');
$url = 'https://foo.bar' . $uri;