Jump to content

Recommended Posts

okay how would i create a script using file_get_contents() in php have it grab search pages 1-20 and return the results based on whatever username was typed into the form.

 

liek for example i would type "thisismyusername" and it would check all search pages for that exact username and if it came up empty to return "sorry, no username has been found matching this username" or else return "the username so and so has been found"

 

the search url is this:

http://vampirefreaks.com/gothicresults.php?pg=1&sex=male&sortby=user_datejoined

and you can manually enter the page or change it by changing the pg= variable

Link to comment
https://forums.phpfreaks.com/topic/189215-using-file_get_contents/
Share on other sites

oh i got it now thanks but how would i set it up? like give me an example.

 

this is what i got so far:

<?php
$username=strip_tags(mysql_real_escape_string($_POST['username']));
$paedo=file_get_contents("http://vampirefreaks.com/profile.php?user=$username");
?>

how do i make it so it returns if the username exists or not?

<?php
$username=strip_tags(mysql_real_escape_string($_POST['username']));
$paedo=file_get_contents("http://vampirefreaks.com/profile.php?user=$username");
?>

 

how do i make it so it returns if the username exists or not?

 

sorry i ran out of time to edit it LOL

<?php
$url='http://vampirefreaks.com/profile.php?user=';
$user='Mattykins';
$file = file_get_contents("$url$user");
echo "$file";
?>

 

note: this will display the page in your web browser, you will have to parse the users data out of $file. You should also input a fake user so you can see what gets returned so you can tell the diff.

 

 

HTH

Teamatomic

OK.

 

$file will return the page in a string. you need to look at the source of the page(use your browser) and see how it is formatted. You should also put in a username like '2d4gstfg5gafj' or some other gobbly gook that you know is not a real user and see what is returned. You then will need to make a preg_match to get the users data. The page output looks well commented so it will be that difficult. Once you have the block you desire put it into an array by exploding the \n then go through and strip the html tags and drop enmpty lines. You should end up with lines like:

 

Sex:  male

Age: 19

Location: Melbourne, Victoria, Australia

 

 

HTH

Teamatomic

is there a more easier way just to match a few text phrases on the page? like "user has been deleted by VF admin For:" or "This user has Been suspended by vf admin for:"

 

and if it matches to return "this user has Been Deleted/Suspended" :shrug:

Just on a quick perusal of the returned page(s) from the advanced menu option all data is on a seperate line. So to do this easy and search through just use file() instead of file_get_contents then remove empty lines and strip the html tags then filter the lines you want to look for as you loop through the array. Use 'if' to filter then you can format your response and just output it. Or use file_get_contennts and do a preg_match for all the things you might find and format a response from that.

 

Either way you have to do a bit of work, if it was 'real easy' everyone would be able to do it and no one would need sites like this. But what you are trying to do is fairly trivial once you get some experience under your belt and you will be able to bang something like that out from start to finish in about 1/2 hour, debugging and all.

 

 

HTH

Teamatomic

 

 

HTH

Teamatomic

<?php
$user=$_POST['user'];
if(empty($user)){
?>
<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form>
<?php
}else{
$url='http://vampirefreaks.com/profile.php?user=';
$user=$_POST['user'];
$file = file_get_contents("$url$user");
$pattern[0] = 'THIS USER HAS BEEN DELETED BY VF ADMIN
Reason for Deletion:';
$pattern[1] ='This User Has Been Suspended
by VF Admin for:';

if(preg_match($pattern,$file)){ echo "<font color=red>This User has Either Been Deleted or Suspended!</font>";}
echo $file;


}
?>

 

 

it does not match why?

been tinkering around new code:

 

<?php
$user=$_POST['user'];
if(empty($user)){
?>
<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form>
<?php
}else{
$url='http://vampirefreaks.com/profile.php?user=';
$user=$_POST['user'];
$file = file_get_contents("$url$user");
$pattern[0] = '<center><hr><h3>THIS USER HAS BEEN DELETED BY VF ADMIN<br>   Reason for Deletion:  </h3></h3><hr></center>';
$pattern[1] ='<center><table border=4 bordercolor=white bgcolor=black width=100%><tr align=center><td><font color=red><h3>This User Has Been Suspended<br>by VF Admin for: 
</h3></font></td></tr></table></center>'; 


if(preg_match($pattern,$file)){ echo "<font color=red>This User has Either Been Deleted or Suspended!</font>";} else{
echo'<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form> <font color=red>This user has been suspended/deleted By VF Admin!</font>';
}



}
?>

 

 

however now it just says everyone has been deleted or suspended it really isnt matching :shrug:

tried stripos()

 

it pretty much bypasses it now and just echoes the userpage :confused:

 

<?php
$user=$_POST['user'];
if(empty($user)){
?>
<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form>
<?php
}else{
$url='http://vampirefreaks.com/profile.php?user=';
$user=$_POST['user'];
$file = file_get_contents("$url$user");
$pattern = '<center><hr><h3>THIS USER HAS BEEN DELETED BY VF ADMIN<br>   Reason for Deletion:  </h3></h3><hr></center>';
$pattern2 ='<center><table border=4 bordercolor=white bgcolor=black width=100%><tr align=center><td><font color=red><h3>This User Has Been Suspended<br>by VF Admin for: 
</h3></font></td></tr></table></center>'; 


if(stripos($file,$pattern)){ echo "<font color=red>This User has been Deleted!</font>";}
if(stripos($file,$pattern2)){ echo "<font color=red>This User has been Suspended!!</font>";}
else { echo $file;}
}


?>

 

 

 

 

 

Maybe this will give you a hint as to what ot do and what is going on:

<?php
$url='http://vampirefreaks.com/profile.php?user=';
$user='mojoblojowammo';
$file = file("$url$user");
foreach($file as $lines)
{
$line=strip_tags($lines);
$line=trim("$line");
if ($line != ''){
echo "$line<br>\n";
if($line == 'THIS USER DOES NOT EXIST'){$message='this user is dead';}
}
}

if ($message)
{ echo "<font color=red>$message</font>";} else{
echo'<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form> <font color=red>This user has been suspended/deleted By VF Admin!</font>';
}
?>

If you leave the echo uncommented can you see the line you are trying to filter. Thats part of the echo, debugging. If you cant see the lines how can you know the one you are trying to filtering is even contained in the page you got and then how can you debug the code?

 

Leave the echo on and can you see the line you are filtering on?

 

 

HTH

Teamatomic

Sounds as if you added it after the ending bracket for the forst if or foreach.

if ($line != ''){
echo "$line<br>\n";
if($line == 'THIS USER DOES NOT EXIST'){$message='this user is dead';}
//next if goes here#if($xxx){$message='xxx';}
//next if goes here#if ($yyy){$message='yyy';}
}
}

 

I would use multiple ifs, I find it easier to stack($message.='yyy<br>';) messages.

 

 

HTH

Teamatomic

that is however not the case :'(

 

 

<?php
foreach($file as $lines)
{
$line=strip_tags($lines);
$line=trim("$line");
if ($line != ''){
//echo "$line<br>\n";
if($line == 'THIS USER DOES NOT EXIST'){$message='This user is dead!';}
if($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: pervert'){$message='This User Has Been Deleted!';}
if($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion:'){$message='This user has Been Deleted!!';}
}
}
?>

 

 

All i get is a blank page cept for the first if

OK.

If you look at the page you see

THIS USER HAS BEEN DELETED BY VF ADMIN

then the next line has the reason. You need to filter on:

THIS USER HAS BEEN DELETED BY VF ADMIN

then capture the next line as the reason.

fairly simple.

if($line=='THIS USER HAS BEEN DELETED BY VF ADMIN')

{

$reason = next($file);//gets the next pointer in the array

$message="THIS USER HAS BEEN DELETED BY VF ADMIN::$reason";

}

 

HTH

Teamatomic

For some reason that lline contains a bunch of extra spaces. I added a preg_replace to replace all multiple spaces wtih one. Here is the code. at the bottom you will notice I have a commented out preg_match. you can use this to match part of a line if needed.

<?php
$url='http://vampirefreaks.com/profile.php?user=';
$user='Viamund_the_Rake';
$file = file("$url$user");
foreach($file as $lines)
{
$line=strip_tags($lines);
$line=trim("$line");
if ($line != ''){
$line=preg_replace('/\s+/',' ',$line);
echo "$line<br>\n";
if($line == 'THIS USER DOES NOT EXIST'){$message='this user is dead';break;}
if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion:')
{$message="$line $user";}
}
}

if ($message)
{ echo "<font color=red>$message</font>";} else{
echo'<form method="post">
<input type="text" name="user">
<input type="submit" name="submit" value="Assimilate!">
</form> <font color=red>This user has been suspended/deleted By VF Admin!</font>';
}
//if (preg_match("/THIS USER HAS BEEN DELETED BY VF ADMIN/i","$line"))
?>

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.