Jump to content

grab variable value from a remote server


maxwel
Go to solution Solved by maxwel,

Recommended Posts

i want to get value of a variable that on another server to simply log the username of the user who access a page on the server that got the variable 

(variable =  $_SESSION[username])

 

so i wanna use php script to grab value of this variable (on other server) to log it in a txt file. i got everything working except being able to grab value of variable which is username

Link to comment
Share on other sites

Use curl, log in to the remote server and get the content that belongs to this particular user.

 

Another alternative is to use ssh (if the server provide it) to log into it without GUI (graphical user interface) and to get the content by php-cli. 

Edited by jazzman1
Link to comment
Share on other sites



<?php
session_start();
$dj_name_session = $_SESSION[rp_djname];
echo $dj_name_session;
$sam = '1234';
echo $sam;
?>

i found that echo of sam do appear when i use file_get_conetent but  $name_session dont :S although it show when i acess the file through browser duh

Edited by maxwel
Link to comment
Share on other sites

How to get this content through the browser with log in or without it?

 

Run that code and try to get the content from my server. I'm using session_start() and $_SESSION.

<?php

$testpage = file_get_contents('http://canada.lesno.net/info.php');

echo $testpage;
Link to comment
Share on other sites

  • Solution

hello jazzman1 XD

 

yours work

 

but, unfortunatly when i used the same with session_start() and $_SESSION. it didnt work :(  but for 1234 variable it worked :S

 

with login, anyways i did it in another way thanks alot for your help :)

Edited by maxwel
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.