1

if i had a website create in php. running on a university server. from this website i log in and end up at a file profile.php and i have session data.

Separately i have a game created using node.js. this i currently run on my computer on a localhost. i wish to link the two at the moment on my computer.

so if i use:

php -S localhost:4000

assume my website is running here and i log in and end up at profile.php how would i relocate to the game which is a multiplayer game running on localhost:8080

i tried:

<?php
header("location: http://localhost:8080");
?> 

however i get an error saying Warning: Cannot modify header information - headers already sent by (output started at C:\Users\Student\Documents\game\profile.php:6)

Ben
  • 45
  • 6

1 Answers1

-1

You probably need to replace the localhost with your computer IP address. Because, your php code is not running from localhost. You can find your pc Ip address by running

ipconfig

In terminal. Then, replace it. It should work

NothingtoSay
  • 162
  • 4
  • 14