Skip to content

Instantly share code, notes, and snippets.

@adentify
adentify / gist:33a4238699026616e0566622791601cb
Last active January 16, 2022 19:57
How to get PHP & CURL to work with NordVPN Socks5 Proxy Servers
<?php
header('Content-Type:text/plain'); // this script dumps the response object to the page, this just ensures it looks nice in the browser
$conf["url"] = "https://ipapi.co/json/"; // the URL you wish to fetch, this particular endpoint will return a JSON object detailing Geo/IP details of the proxy you are using as a proof the proxy is working
$conf["useragent"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
// NordVPN socks servers use specifc domains it seems - https://support.nordvpn.com/Connectivity/Proxy/1047410732/Proxy-setup-on-uTorrent.htm
// uncomment whichever server you wish to check.
// $conf["proxy"]["host"] = "amsterdam.nl.socks.nordhold.net";
// $conf["proxy"]["host"] = "atlanta.us.socks.nordhold.net";
@adentify
adentify / gist:9a53eec0c2d69a18c265f20943996a22
Created August 12, 2016 13:09
PHP Delay response, handy for testing code dealing with slow responding sites.
<?php
header("Content-type: text/plain");
$payload = "";
// pass delay as param with length of 'd' in milliseconds
if(isset($_GET['delay'])){
$delay = $_GET['delay'];
if($delay > 30000){
$delay = 0;
$payload .= "// max timeout exceeded, we've set this as 0ms\n";
}