|
@@ -1,118 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-include 'inc/req.php';
|
|
|
-
|
|
|
-
|
|
|
-$uafile = dirname(__FILE__).'/ua.txt';
|
|
|
-$file = fopen($uafile,'r');
|
|
|
-$useragent = fread($file,filesize($uafile));
|
|
|
-fclose($file);
|
|
|
-$valid_requests = $ALLOWED_HOSTS;
|
|
|
-
|
|
|
-include 'inc/headers.php';
|
|
|
-
|
|
|
-$request_url = "https://www.semrush.com".$_SERVER['REQUEST_URI'];
|
|
|
-
|
|
|
-
|
|
|
-$p_request_url = parse_url( $request_url );
|
|
|
-
|
|
|
-include 'inc/requeired.php';
|
|
|
-
|
|
|
-if ( $request_method == 'GET' && count( $request_params ) > 0 && (!array_key_exists( 'query', $p_request_url ) || empty( $p_request_url['query'] ) ) ) {
|
|
|
- $request_url .= '?' . http_build_query( $request_params );
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-$cookie = $cookie = dirname(__FILE__).'/cookie.txt';
|
|
|
-
|
|
|
-$uaa = $useragent;
|
|
|
-// let the request begin
|
|
|
-$ch = curl_init( $request_url );
|
|
|
-
|
|
|
-curl_setopt ($ch, CURLOPT_USERAGENT, $uaa);
|
|
|
-curl_setopt($ch, CURLOPT_REFERER, "https://www.semrush.com");
|
|
|
-curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers ); // (re-)send headers
|
|
|
-curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
|
|
|
-curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
-curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
-curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // return response
|
|
|
-curl_setopt( $ch, CURLOPT_HEADER, true ); // enabled response headers
|
|
|
-curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
|
|
|
-// add data for POST, PUT or DELETE requests
|
|
|
-if ( 'POST' == $request_method ) {
|
|
|
- $post_data = is_array( $request_params ) ? http_build_query( $request_params ) : $request_params;
|
|
|
-
|
|
|
- $has_files = false;
|
|
|
- $file_params = array();
|
|
|
-
|
|
|
- foreach ($_FILES as $f => $file) {
|
|
|
- if($file['size']){
|
|
|
- $file_params[$f] = '@'. $file['tmp_name'] .";type=". $file['type'];
|
|
|
- $has_files = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if($isMultiPart || $has_files){
|
|
|
- foreach(explode("&",$post_data) as $i => $param) {
|
|
|
- $params = explode("=", $param);
|
|
|
- $xvarname = $params[0];
|
|
|
- if (!empty($xvarname))
|
|
|
- $file_params[$xvarname] = $params[1];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- curl_setopt( $ch, CURLOPT_POST, true );
|
|
|
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $isMultiPart || $has_files ? $file_params : $post_data );
|
|
|
-} elseif ( 'PUT' == $request_method || 'DELETE' == $request_method ) {
|
|
|
- curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $request_method );
|
|
|
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $request_params );
|
|
|
-}
|
|
|
-
|
|
|
-// retrieve response (headers and content)
|
|
|
- $response = curl_exec( $ch );
|
|
|
-
|
|
|
-$response = str_replace('srf-browser-unhappy"', 'srf-browser-unhappy" style="display:none;"', $response);
|
|
|
- $response = str_replace('srf-navbar__right"', 'srf-navbar__right" style="display:none;"', $response);
|
|
|
- $response = str_replace('<footer', '<footer style="display:none;"', $response);
|
|
|
- $response = str_replace('srf-report-sidebar-management "', 'srf-report-sidebar-management " style="display:none;"', $response);
|
|
|
-$response = str_replace('srf-report-sidebar-extras "', 'srf-report-sidebar-extras " style="display:none;"', $response);
|
|
|
-$response = str_replace('www.semrush.com', 'sem.bunnytools.shop', $response);
|
|
|
-$response_headers = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
|
|
|
-$response_content = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
|
|
|
-curl_close( $ch );
|
|
|
-
|
|
|
-// split response to header and content
|
|
|
-//list($response_headers, $response_content) = preg_split( '/(\r\n){2}/', $response, 2 );
|
|
|
-
|
|
|
-// (re-)send the headers
|
|
|
-$response_headers = preg_split( '/(\r\n){1}/', $response_headers );
|
|
|
-foreach ( $response_headers as $key => $response_header ) {
|
|
|
- // Rewrite the `Location` header, so clients will also use the proxy for redirects.
|
|
|
-
|
|
|
- if ( !preg_match( '/^(Transfer-Encoding):/', $response_header ) ) {
|
|
|
- header( $response_header, false );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-if($_SERVER['REQUEST_URI'] === "/"){
|
|
|
- header('Location: https://sem.bunnytools.shop/analytics/overview/');
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-if($_SERVER['REQUEST_URI'] === "/_compatibility/traffic/overview/"){
|
|
|
- header('Location: https://sem.bunnytools.shop/analytics/traffic/overview/ebay.com');
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- print_r($response_content);
|
|
|
-
|
|
|
-function csajax_debug_message( $message )
|
|
|
-{
|
|
|
- if ( true == CSAJAX_DEBUG ) {
|
|
|
- print $message . PHP_EOL;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-if (strpos($_SERVER['REQUEST_URI'], '/switch_language_api/') !== false) exit();
|