vendredi 26 juin 2015

Get page content as if opened by user

I'm trying to get some of IPBoard registry data by using external site since 777 chmoding on whole forum registry would be a terrible idea. Registry returns user data for user if he's logged in on forums. I've created a page which initiates the registry and prints the data. Loading the registry and getting the data to page is quite simple

//userQuery.php
<?php
define("ALLOW_FURLS", false);
require_once 'forum/initdata.php';
require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
$registry = ipsRegistry::instance();
$registry->init();

$member = $registry->member()->fetchMemberData();
$data = json_encode($member);

print $data;
?>

and if opened by user works perfectly. Problems started when I tried accessing my userQuery.php through external site as intended. Both curl and fopen from external site acts as requested by server not user visiting the site and returns Guest data since server is not logged in.

So doing

<?php
$url = "http://ift.tt/1NkMs95";
$handle = fopen($url, "r");
$result = fread($handle, 8192);

var_dump($result);
?>

Returns server memberdata which is Guest, instead of user memberdata as userQuery would if accessed normally by opening it in a browser.

Is there a way to open that page (userQuery.php) as if user requested its content using php or js as the last resort? I'm not looking forward to rewriting IPBoard registry just to provide external access checks with the forums.




Aucun commentaire:

Enregistrer un commentaire