Created
June 4, 2017 12:42
-
-
Save Albirew/1403b584e9687a796823f2f9f3475b46 to your computer and use it in GitHub Desktop.
A simple RSS proxy featuring a cloudflare bypass that may or may not work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* cloudflare part by asifpk | |
* seduce.gravity@gmail.com */ | |
function OpenURLcloudflare($url) { | |
//get cloudflare ChallengeForm | |
$page = OpenURL($url); | |
$data = explode('challenge-form',$page); | |
$data = explode('=', $data[1]); | |
$data = explode(';', $data[1]); | |
$value = $data[0]; | |
eval("\$jschl_answer=$value;"); | |
$action = explode('action="',$page); | |
$action = explode('"', $action[1]); | |
$action = $action[0]; | |
$token = explode('"jschl_vc" value="',$page); | |
$token = explode('"',$token[1]); | |
$token = $token[0]; | |
$post['act'] = $action; | |
$post['jschl_vc'] = $token; | |
$post['jschl_answer'] = $jschl_answer; | |
$data = OpenURL($url, $post); | |
return $data; | |
} | |
function OpenURL($url, $post=array()) { | |
$headers[] = 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1'; | |
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01'; | |
$headers[] = 'Accept-Language: ar,en;q=0.5'; | |
$headers[] = 'Connection: keep-alive'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
curl_setopt($ch, CURLOPT_VERBOSE, TRUE); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
if(count($post)>0) { | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
} | |
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/curl.cookie'); | |
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/curl.cookie'); | |
$data = curl_exec($ch); | |
return($data); | |
} | |
if(isset($_GET['rss'])) | |
{ | |
$rss = $_GET['rss']; | |
if(!preg_match('/http[s]?:\/\//', $rss, $matches)) $rss = 'http://'.$rss; | |
header("Pragma: no-cache"); | |
header("Content-type: application/rss+xml"); | |
echo file_get_contents($rss); | |
} | |
elseif(isset($_GET['cf'])) | |
{ | |
$rss = $_GET['cf']; | |
if(!preg_match('/http[s]?:\/\//', $rss, $matches)) $rss = 'http://'.$rss; | |
header("Pragma: no-cache"); | |
header("Content-type: application/rss+xml"); | |
echo OpenURLcloudflare($rss); | |
} | |
else | |
{ | |
echo '<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Proxy RSS</title> | |
<meta name="description" content="Proxy RSS"> | |
<meta name="author" content="Albirew" /> | |
</head> | |
<body> | |
<form method="get" action="proxrss.php"> | |
<input type="text" size="50" name="rss" /> | |
<button type="submit" value="1">GO!</button> | |
</form> | |
<br /><br /> | |
<form method="get" action="proxrss.php"> | |
<input type="text" size="50" name="cf" /> | |
<button type="submit" value="1">GO! (alternative CloudFlare)</button> | |
</form> | |
</body> | |
</html>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment