Jump to content

Parsing Data off a page?


scorpiious

Recommended Posts

well im not the best at php so i gotta ask some questions, i was making a dynamic signature application and im wondering how would you take the data off of another page and split it up?

 

so far i have

 

$name = $_GET["user"];
$string = fopen("http://hiscore-web.runescape.com/aff/runescape/hiscorepersonal.cgi?username=".$name,"r");

 

where should i go from here?

Link to comment
https://forums.phpfreaks.com/topic/48970-parsing-data-off-a-page/
Share on other sites

Well....fopen() opens a FILE on a server...so when you pass the string that you have there, it isn't pointing to a location on a server.  You're just giving it a url...it would have to be something like...http://hiscore-web.runescape.com/aff/runescape/files/myfile.txt.

 

If the file name is like....bob.txt, then it would make sense what you're trying to do....

 

// get the original contents (supposedly for an email, since you're doing "signatures")...
$contents = $_GET['contents'];
// username of the email author supposedly..
$name = $_GET['user'];
// directory where all of the signature text files reside...
$directory = 'http://hiscore-web.runescape.com/aff/runescape/files/';

// open up the appropriate signature file...
$file = fopen($directory . $name . '.txt', 'r');
// read it's contents
$data = fread($file, filesize($directory . $name . '.txt'));

// append the contents of the signature file to the contents of the email...
$contents .= $data;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.