Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


PHP file_get_contents
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Geek4Ever
Master Cheater
Reputation: 1

Joined: 31 Oct 2008
Posts: 353
Location: Milano,Texas

PostPosted: Tue Jun 23, 2009 5:14 pm    Post subject: PHP file_get_contents Reply with quote

ok i want to find lets say money but the money vaule changes how would i get it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25823
Location: The netherlands

PostPosted: Tue Jun 23, 2009 8:58 pm    Post subject: Reply with quote

just modify it in the database
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Geek4Ever
Master Cheater
Reputation: 1

Joined: 31 Oct 2008
Posts: 353
Location: Milano,Texas

PostPosted: Wed Jun 24, 2009 12:57 am    Post subject: Reply with quote

i got this but this wont get the value cause it dont know what it is and the vaule is differnet for each player and its own profile shows there money and i want to get the vaule for it how is this possiable.

Code:

$url = 'http://www.foo.com.foo.php';
$text = '<span>Money</span>';//but on the page its like Money 324543 and its different every time
$contents = file_get_contents($url);
if(strpos($contents,$text)!== false) {
echo 'found';
} else {
echo 'not found';
}


example
Code:
<html>
<head>
<title>Foo</title>
<head>
<body>
<li><span>Money</span>10000</li>//the vaule is differnet from each page
</body>
</html>
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 3:09 am    Post subject: Reply with quote

I would use the php explode (cause it would be faster than using regex).

Code:

$temp = explode($contents,$text)[1]; //the [1] is so we get all the data after the $text

$money = explode($temp,"</li>")[0]; //[0] so we get everything before "</li>", so the money value
Back to top
View user's profile Send private message
Geek4Ever
Master Cheater
Reputation: 1

Joined: 31 Oct 2008
Posts: 353
Location: Milano,Texas

PostPosted: Wed Jun 24, 2009 3:39 am    Post subject: Reply with quote

Code:
Parse error: syntax error, unexpected '[' in /home2/pppppppppppp/public_html/jjjjjjjj/po.php on line 3



this is what i got.

Code:
<?php
$text = '<span>EXP</span>';
$contents = file_get_contents($url);
$temp = explode($contents,$text)[1];
$money = explode($temp,'</li>')[0];
$url = 'foo.php';
$contents = file_get_contents($url);
echo $money;
?>
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 4:19 am    Post subject: Reply with quote

Apparantly PHP doesn't like it when you immediatly ask a value of a function that returns an array.
Plus, I switched the arguments of explode().

This worked for me (when I defined $url on line 1).

Code:
<?php
$text = '<span>EXP</span>';
$contents = file_get_contents($url); //MAKE SURE YOU DEFINE $url ABOVE THIS LINE!!
$temp = explode($text,$contents);
$money = explode('</li>',$temp[1]);
$url = 'foo.php';
$contents = file_get_contents($url);
echo $money[0];
?>
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jun 24, 2009 4:32 am    Post subject: Reply with quote

DanielG wrote:
Apparantly PHP doesn't like it when you immediatly ask a value of a function that returns an array.
Plus, I switched the arguments of explode().

This worked for me (when I defined $url on line 1).

Code:
<?php
$text = '<span>EXP</span>';
$contents = file_get_contents($url); //MAKE SURE YOU DEFINE $url ABOVE THIS LINE!!
$temp = explode($text,$contents);
$money = explode('</li>',$temp[1]);
$url = 'foo.php';
$contents = file_get_contents($url);
echo $money[0];
?>


It's impossible that it worked for you, because basically you are requesting file_get_contents($url) while you haven't defined $url yet! Followed by that you try to find '<span>EXP</span>' in $contents, which is empty. Then you try to find </li> in $temp[1], which is basically not there, because it splitted nowhere, because $temp is empty. Then you suddenly re-request the $url for no reason at all!


Last edited by Cheat Engine User on Wed Jun 24, 2009 4:36 am; edited 2 times in total
Back to top
View user's profile Send private message
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 4:35 am    Post subject: Reply with quote

Holly wrote:
DanielG wrote:
...


It's impossible that it worked for you, because basically you are requesting file_get_contents($url) while you haven't defined $url yet! Followed by that you try to find '<span>EXP</span>' in $contents, which is empty. Then you try to find </li> in $temp[1], which is basically not there, because it splitted nowhere, because $temp is empty. Then you suddenly re-request the $url for no reason at all!


I'm guessing reading is not your strongest point.
Let me put it in bold for you:
"This worked for me (when I defined $url on line 1)." and "//MAKE SURE YOU DEFINE $url ABOVE THIS LINE!! "

So my code had $url = "./testfile.txt" on line one (and the rest pushed down).

Also the "Then you suddenly re-request the $url for no reason at all!
" that is because it is in his code and I didn't felt the need to remove it (he might have legitimate use for it).


Seriously, lrn2context.


Last edited by DanielG on Wed Jun 24, 2009 4:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jun 24, 2009 4:38 am    Post subject: Reply with quote

DanielG wrote:
Holly wrote:
DanielG wrote:
...


It's impossible that it worked for you, because basically you are requesting file_get_contents($url) while you haven't defined $url yet! Followed by that you try to find '<span>EXP</span>' in $contents, which is empty. Then you try to find </li> in $temp[1], which is basically not there, because it splitted nowhere, because $temp is empty. Then you suddenly re-request the $url for no reason at all!


I'm guessing reading is not your strongest point.
Let me put it in bold for you:
"This worked for me (when I defined $url on line 1)."

So my code had $url = "./testfile.txt" on line one (and the rest pushed down).

Also the "Then you suddenly re-request the $url for no reason at all!
" that is because it is in his code and i didn't felt the need to remove it (he might have legitimate use for it).
Reading might be harder for me, but at least I can code. And there is no possible way there's a legimate use for it, it's just useless getting the same page in the same 0.0010 seconds.

Oh yeah, reading might be hard for you as well: Your $text was totally wrong. Finding something as stupid as that just wouldn't give any good results.

I done it myself now, with the example page given up there. You can find the results on http://irule.at/testing
Code:
<?php
$text = '</span>';
$url = 'http://oh.mengpz.com/testing/foo.php'; //suckahz, was that too hard?
$contents = file_get_contents($url);
$temp = explode($text,$contents);
$money = explode('</li>',$temp[1]);
echo $money[0];
?>
Back to top
View user's profile Send private message
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 4:41 am    Post subject: Reply with quote

You seem more like an angry troll than someone who wants to admit he made a reading mistake.
It's okay though, I bet your e-penis is huge.

//edit:

"Your $text was totally wrong. Finding something as stupid as that just wouldn't give any good results."
No it wasn't, if there is more than one "</span>" in the html code (which i bet there is) then your one is at fault.

"<span>EXP</span>" is more likely to occur once in the html he is trying to rip.




You seem like an angry kid. Relax man.


Last edited by DanielG on Wed Jun 24, 2009 4:44 am; edited 1 time in total
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jun 24, 2009 4:43 am    Post subject: Reply with quote

DanielG wrote:
You seem more like an angry troll than someone who wants to admit he made a reading mistake.
It's okay though, I bet your e-penis is huge.
I believe I actually admitted I made a reading mistake, if you read it correctly. And my e-penis is fucking gigantic.
Back to top
View user's profile Send private message
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 4:46 am    Post subject: Reply with quote

Just get off your high horse.
My post was correct, it works as requested.
Plus I work as full time programmer so I can code aswell (Wink).
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jun 24, 2009 4:53 am    Post subject: Reply with quote

DanielG wrote:
Just get off your high horse.
My post was correct, it works as requested.
Plus I work as full time programmer so I can code aswell (Wink).
Ik zal het in het Nederlands doen, sinds jij het niet in het Engels wil of kan lezen, en daarnaast zal ik het lettertype gigantisch maken, zodat je het ook niet kan missen:

Jij probeert
Code:
<span>EXP</span>

LETTERLIJK te vinden in iets als
Code:
<html>
<head>
<title>Foo</title>
<head>
<body>
<li><span>Money</span>10000</li>//the vaule is differnet from each page
</body>
</html>

Daardoor zal php denken: 'hey dude wtf dat kan ik niet vinden.';
Dat komt omdat PHP zo fucking logisch mogelijk is, hij gaat het LETTERLIJK zoeken. Sinds er geen EXP staat, maar money, ziet hij hem niet. Daarnaast kan je ook alleen </span> nemen, spaart bytes.


Jesus Christus.
Back to top
View user's profile Send private message
DanielG
Expert Cheater
Reputation: 1

Joined: 13 May 2009
Posts: 130
Location: The Netherlands

PostPosted: Wed Jun 24, 2009 4:58 am    Post subject: Reply with quote

Gast,

doe eens logisch nadenken.
Het kan toch zijn dat hij nu EXP zoekt en niet Money?
Wat is daar zo raar aan?

En als je op </span> zoekt dan komen er waarschijnlijk honderderden terug, terwijl <span>xxx</span> veel specifieker is.

Ik heb geen zin in je ongegronde woede en e-penis.
Ik reageer niet meer op jou Wink.

En take a chill pill, it's better for your heart if you don't e-rage.
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jun 24, 2009 5:03 am    Post subject: Reply with quote

DanielG wrote:
Gast,

doe eens logisch nadenken.
Het kan toch zijn dat hij nu EXP zoekt en niet Money?
Wat is daar zo raar aan?

En als je op </span> zoekt dan komen er waarschijnlijk honderderden terug, terwijl <span>xxx</span> veel specifieker is.

Ik heb geen zin in je ongegronde woede en e-penis.
Ik reageer niet meer op jou Wink.

En take a chill pill, it's better for your heart if you don't e-rage.
Lees derde post van de original poster, en de tweede [code].

Meer heb ik niet te zeggen. Ik e-rage btw niet, het kan me niet schelen, ik hielp je met het vergroten van mijn tekst.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites