Jump to content

Recommended Posts

I'm not what you may call "good" with PHP, so I thought I should probably ask about this.

 

I'm trying to put together a list of everybody who plays this game called "Urban Dead". The member ID system is pretty simple; everybody gets the next number that was available when they join. (So, if you joined, and the last person who joined got 1000, you would get 1001.)

 

The basic idea is that it would record the ID number and the name, then add it to a page with all of the number on it. This is what I've been doing manually so far, but I'm starting to get carpal tunnel syndrome from pressing Ctrl, V, and C.

 

I was wondering, would it be possible to make a script where you just enter two numbers, (Ex- 1 and 1000) and then it would go through every ID between those two numbers and records the data to the document, or sends it via email to me? (The data, of course, being the ID number and the stuff between <span class="ptt"> and </span>, which is the name of the person)

 

It sounds bloody complicated, but I think complicated coding is better than going through all ~1 100 000 profiles.

Link to comment
https://forums.phpfreaks.com/topic/84676-solved-is-this-possible/
Share on other sites

try

<form method="POST">
Start:<input type="text" name="start" /><br />
End:<input type="text" name="end" /><br />
<input type="submit" name="submit" value="submit" />
</form>
<?php
if ($_POST['submit']){
echo '<table border="3"><tr><td>ID</td><td>NAME</td></tr>';
for ($i = $_POST['start']; $i <= $_POST['end']; $i++) {
	$file = 'http://www.urbandead.com/profile.cgi?id='.$i;
	$a = file_get_contents($file);
	preg_match('/<span class="ptt">(.*)<\/span>/',$a,$b);
	echo "<tr><td>$i</td><td>{$b[1]}</td></tr>\n";
}
echo '</table>';
}
?>

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.