Jump to content

Text File Links?


Pegasus3245

Recommended Posts

Hi All,

Having a dilema here...

 

I run a games server, its a crap web based game - ill not go into detail.

 

Anyhow, the server URL changes when the server is restarted, this is automatically saved into a text file. I then have a batch file which automatically copies this file onto my web server every 10 minutes. I then have a php page which reads this text file and a couple others. The webpage looks a little like;

 

Server Status

online

 

Server Address

www.webgame.com

 

etc.etc....

 

The problem is, the link doesnt display as a clickable link, this is what I am wanting. Its just displayed as plain text, you have to then copy and paste this link into your browser, I would really like the link to just be clickabe.

 

The code I am currently using is;

<p align="center" class="style1">Server Location:</p>
<p align="center" class="style3">
<?php
$filename = "externalurl.txt";
$filehandle = fopen($filename, "r");
$contents = fread($filehandle, filesize($filename));
fclose($filehandle);
echo $contents;
?>
</p>
<br>

 

I basically want the link to display as is, I did try putting the whole thing inside <a href"<CODE>"> this unsurprisingly didnt work. I have seen loads of other help websites etc, these all only show methods of displaying links that have the actual code in the text file, my text file has no code in there, just the actual link - and this cannot be changed.

 

Any help would be greatly apreciated.

Link to comment
Share on other sites

Hi Ignace,

Thats great, its working as a link now, however I have the issue that the hyperlink has my web server address in front followed by a , even though the text file doesnt have this inside.

 

Text File: www.gameserver.com

 

<p align="center" class="style1">Server Location:</p><p align="center" class="style3"><a href="<?= file_get_contents('externalurl.txt') ?>">click here</a></p><br>

 

This produces click here to have a link to: www.myserver.com/http://www.gameserver.com cant figure this one out.

 

Kind Regards,

Scott.

Edited by Pegasus3245
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.