Skip to content

Instantly share code, notes, and snippets.

View atefBB's full-sized avatar
🎯
Focusing

Atef Ben Ali atefBB

🎯
Focusing
View GitHub Profile
@atefBB
atefBB / tor_curl.php
Last active February 26, 2024 01:58 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) {
echo "ERROR: $error_number : $err_string";
@atefBB
atefBB / PHP-CURL-Tor-Tutorial.md
Last active February 11, 2022 02:07 — forked from megaxorg/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor

CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php5 php5-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

@atefBB
atefBB / response.php
Created July 31, 2018 05:55 — forked from luckyshot/response.php
Web scraping done right (with cUrl and user agent)
<?php return array (
'url' => 'https://xaviesteve.com/',
'content_type' => 'text/html; charset=UTF-8',
'http_code' => 200,
'header_size' => 578,
'request_size' => 229,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 0.27407799999999999,
@atefBB
atefBB / scrape.php
Created July 16, 2018 07:24 — forked from ziadoz/scrape.php
Scraping Google using PHP and Goutte:
<?php
/**
* Todo: Send a random user agent string and sleep a random amount between requests.
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Extract and sanatize input:
$domain = filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_URL);
$terms = filter_input(INPUT_POST, 'terms', FILTER_SANITIZE_STRING);
// Setup Goutte (which also includes Guzzle):
@atefBB
atefBB / Validation.php
Last active May 10, 2018 14:35 — forked from JacobBennett/Validation.php
Laravel Custom Validation to check if the given value Exists as a Column in Table
<?php
// BELIEVE THIS ONLY WORKS WHEN USING MYSQL
// DROP THIS INTO GLOBAL.PHP
Validator::extend('columnexists', function($attribute, $value, $parameters)
{
$query = DB::select("SHOW COLUMNS FROM " . $parameters[0]);
$columns = array();
@atefBB
atefBB / bootstrap.js
Last active November 16, 2017 13:24 — forked from davemo/bootstrap.js
injectorsauce
(function() {
/**
* Bootstrap ng-app.
*/
var $injector = angular.injector(['ng']);
$injector.invoke(function($http) {
$http.get("/auth/csrf_token").then(function(response) {
angular.module("app").constant("CSRF_TOKEN", response.csrf_token);
angular.bootstrap(document, ['app']);
@atefBB
atefBB / MultiUserProvider.php
Last active November 15, 2017 16:56 — forked from Xethron/MultiUserProvider.php
Laravel 4 Authenticate Multiple User ProviderAllows Laravel Auth to login using multiple tables and/or databases/Eloquent User Models... Each User Model can have its own Hasher and Hasher options...
<?php
//app/libraries/MultiUserProvider.php
use Illuminate\Auth\UserProviderInterface,
Illuminate\Auth\UserInterface,
Illuminate\Auth\GenericUser;
class MultiUserProvider implements UserProviderInterface
{
/**
@atefBB
atefBB / CronRunCommand.php
Last active October 12, 2017 16:05 — forked from sisou/CronRunCommand.php
Cron job command for Laravel 4.2
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
# Author: Atef Ben Ali (gitHub: atefBB)
#
# Requirements:
# =============
@atefBB
atefBB / back-to-top-directive.js
Last active June 5, 2017 13:15 — forked from sean-hill/AngularJS Back To Top Directive
AngularJS Back To Top Directive
// Back to top Directive
angular
.module('app.directives')
.directive('backToTop', function() {
return {
restrict: 'E',
replace: true,
template: '<div class="back-to-top"><i class="fa fa-chevron-up"></i></div>',
link: function($scope, element, attrs) {
@atefBB
atefBB / vanilla-js-cheatsheet.md
Created May 19, 2017 10:05 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet