$id = basename($_SERVER['REQUEST_URI']);if (isset($_SERVER['REQUEST_URI'])) {
$id = basename($_SERVER['REQUEST_URI']);
}<?php
/**
* Data Processing & Received
*/
$id = isset( $_SERVER[ 'REQUEST_URI' ] ) ? basename( $_SERVER[ 'REQUEST_URI' ] ) : false;
$url = "http://сайт.ру";
$post_data = array("url" => "http://сайт2.ру/$id");
$ch = curl_init();
$user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? basename( $_SERVER[ 'HTTP_USER_AGENT' ] ) : false;
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$postResult = curl_exec($ch);
curl_close($ch);
echo $postResult;
// OR
header('HTTP/1.0 404 Not Found');
?>
$id = isset($_SERVER['REQUEST_URI']) ? basename($_SERVER['REQUEST_URI']) : false;
if ($id !== false) {
// ...
} $id = isset( $_SERVER[ 'REQUEST_URI' ] ) ? basename( $_SERVER[ 'REQUEST_URI' ] ) : false;if ( $id !== false ) {
// ...
}<?php
/**
* Data Processing & Received
*/
$id = isset( $_SERVER[ 'REQUEST_URI' ] ) ? basename( $_SERVER[ 'REQUEST_URI' ] ) : false;
$url = "http://сайт.ру";
$post_data = array("url" => "http://сайт2.ру/$id");
$ch = curl_init();
$user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? basename( $_SERVER[ 'HTTP_USER_AGENT' ] ) : false;
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$postResult = curl_exec($ch);
curl_close($ch);
echo $postResult;
// OR
header('HTTP/1.0 404 Not Found');
?>
$id = isset( $_SERVER[ 'REQUEST_URI' ] ) ? basename( $_SERVER[ 'REQUEST_URI' ] ) : false;
// Убрал здесь basename() вокруг $_SERVER[ 'HTTP_USER_AGENT' ] из-за бессмысленности.
$user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : false;
$url = 'http://сайт.ру';
if ( $id !== false && $user_agent !== false ) {
$post_data = array( 'url' => $url . '/' . $id );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$postResult = curl_exec( $ch );
curl_close( $ch );
echo $postResult;
} else {
header( 'HTTP/1.0 404 Not Found' );
} if ( $id !== false && $user_agent !== false ) {
$post_data = array( 'url' => $url . '/' . $id );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$postResult = curl_exec( $ch );
curl_close( $ch );
echo $postResult;
} else {
header( 'HTTP/1.0 404 Not Found' );
}$post_data = array( 'url' => $url . '/' . $id );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$postResult = curl_exec( $ch );
curl_close( $ch );
echo $postResult;
header( 'HTTP/1.0 404 Not Found' ); $settings = get_option('widget_static_widget');
$cfg = current($settings);
$USER = $cfg['USER'];<?php
ini_set("display_errors", "On");
require_once(dirname(__FILE__).'../../../../wp-config.php');
$id = isset( $_SERVER[ 'REQUEST_URI' ] ) ? basename( $_SERVER[ 'REQUEST_URI' ] ) : false;
$user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : false;
$url = "http:/сайт.ру/test.php";
$settings = get_option('widget_static_widget');
$cfg = current($settings);
$USER = $cfg['USER'];
if ( $id !== false && $user_agent !== false ) {
$post_data = array("url" => "http://другой-сайт.ру/$USER/$id");
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$postResult = curl_exec($ch);
curl_close($ch);
echo $postResult;
} else {
header( 'HTTP/1.0 404 Not Found' );
}
?>
$settings = get_option('widget_static_widget');
$cfg = current($settings);
$USER = $cfg['USER'];