$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' );
}
?>
$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' );
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' );
}
<?php
function func($title,$name) {
// работаем с $title $name
$name = get_option('name');
}
?>
require_once('my_plugin.php');
не так нужно было?<?php
require_once('my_plugin.php');
$title = get_option('title');
echo $title;
echo get_option('name');
?>
$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');
?>