Skip to content

Instantly share code, notes, and snippets.

@eye9poob
Created March 20, 2013 02:44
Show Gist options
  • Save eye9poob/5201901 to your computer and use it in GitHub Desktop.
Save eye9poob/5201901 to your computer and use it in GitHub Desktop.
URL Find [PHP Engine]
<?php
$get_url = trim($_GET['url']);
$post_url = trim($_POST['url']);
if (empty($get_url)) {
if (empty($post_url)) {
echo "-1";
exit();
} else {
$url = $post_url;
}
} else {
$url = $get_url;
}
function http_response($url){
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $url);
curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
curl_exec ($resURL);
$intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
curl_close ($resURL);
if ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) { return 0; } else return 1;
}
$file_handle = fopen("admin_pattern.txt", "rb");
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$parts = explode('=', $line_of_text);
if (http_response($url . $parts[0]) == 1) {
echo $parts[0];
exit();
}
}
echo "-2";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment