Skip to content

Instantly share code, notes, and snippets.

@tieutantan
Last active February 10, 2019 15:04
Show Gist options
  • Save tieutantan/16b7587b559479584336a8a3a9c24f3b to your computer and use it in GitHub Desktop.
Save tieutantan/16b7587b559479584336a8a3a9c24f3b to your computer and use it in GitHub Desktop.
Check proxy simple by PHP
<?php
$ip = '77.37.130.187:38578';
$url = 'https://api.ipify.org'; // https://api.ipify.org/?format=json
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $ip);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla Android UCBrowser Safari');
$response = curl_exec($ch);
if(curl_errno($ch)) echo 'Curl error: ' . curl_error($ch);
else echo $response;
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment