Sinisterly
get_file_contents php - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: get_file_contents php (/Thread-get-file-contents-php)

Pages: 1 2


get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

If I use the grt_file_contents, I'll recieve the whole website.
But how do I only recieve a special part of the websites HTML code?


RE: get_file_contents php - dropzon3 - 06-08-2014

I think you mean file_get_contents and it will retrieve URLs if that is enabled in the php config(php.ini).

You'll need to parse the data you want from the response if you only want part of it.

If you really must only have partial data sent back to you then you'll have to send some special headers to the server to tell it to only send certain bytes back: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

If the data is only the first * bytes then you can use fopen to a url and only read that many bytes or using cURL you can set a callback to cetermine how many bytes have been read and abort the connection after so many.

Is there a particular reason why you can't just parse the information out from the entire page? If you can share more about what you actually want to do we can potentially provide an alternative method besides what you are trying.


RE: get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

(06-08-2014, 12:52 AM)dropzon3 Wrote: I think you mean file_get_contents and it will retrieve URLs if that is enabled in the php config(php.ini).

You'll need to parse the data you want from the response if you only want part of it.

If you really must only have partial data sent back to you then you'll have to send some special headers to the server to tell it to only send certain bytes back: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

If the data is only the first * bytes then you can use fopen to a url and only read that many bytes or using cURL you can set a callback to cetermine how many bytes have been read and abort the connection after so many.

Is there a particular reason why you can't just parse the information out from the entire page? If you can share more about what you actually want to do we can potentially provide an alternative method besides what you are trying.

Okay, so I'm going to do this little doxing program.
You enter an email, and that email is going to get logged in on facebook.
But the password is always wrong. I know that everytime you enter a wrong password on facebook it says something like this: "Joshua Tanner, is this really you?".
So, i want to recieve that text back onto my website or whatever.
So from the email I recieved his full name. Voila :3

Thanks for replying by the way. Smile


RE: get_file_contents php - dropzon3 - 06-08-2014

Wouldn't you need to POST the login form then, file_get_contents is only a GET.

Presuming you can get that page though just scrape the html(google screen scraping) to get the information.


RE: get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

(06-08-2014, 10:56 AM)dropzon3 Wrote: Wouldn't you need to POST the login form then, file_get_contents is only a GET.

Presuming you can get that page though just scrape the html(google screen scraping) to get the information.

I was thinking that it's first doing a failed login, without showing it anywhere. And when you get to the "is this really you?" page, it'll pull text back.


RE: get_file_contents php - dropzon3 - 06-08-2014

But how are you getting the failed login from your PHP code.

file_get_contents won't make a login attempt it will just get the login page.7

You'd probably wnat to use something like cURL to POST


RE: get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

(06-08-2014, 11:00 AM)dropzon3 Wrote: But how are you getting the failed login from your PHP code.

file_get_contents won't make a login attempt it will just get the login page.7

You'd probably wnat to use something like cURL to POST

Hmm, I'm not sure yet.
I was thinking if Facebook had some kind of link that looked like this:
Code:
$ip = file_get_contents("http://www.facebook.com/login.php?e={$email}");

And then you could make a textbox that was configuring the email to the variable. Not sure really.
The only problem is that they don't ._.


RE: get_file_contents php - dropzon3 - 06-08-2014

A login to facebook looks something like:

Code:
POST /login.php?login_attempt=1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 Referer: https://www.facebook.com/?stype=lo&jlou=Afd4XBdZVheUjF5ZdeR_FAKE_C6Yb_XIfyd1gU-c9mdm8PFNa6sD31467hPQAqKkvEnyXqN_xy&smuh=4888&lh=Ac-8_&aik=naTwA Cookie: wd=1266x359;reg_fb_ref=asldkfasflkasjdfsadfsafas;etc... Host: www.facebook.com DNT: 1 Connection: keep-alive Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 timezone=240&pass={password}&lsd=AVuFRDlo&locale=en_US&lgnrnd=050614_qu39&lgnjs=1402221972&email={EMAIL}&defalt_persistent=1

its the response to this request that you'd want. That said facebook only leaks the name if the browser has logged into the account with that email before. It won't leak the name if its just a random email you've not logged into before. So you may be wasting your time.


RE: get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

(06-08-2014, 11:13 AM)dropzon3 Wrote: A login to facebook looks something like:

Code:
POST /login.php?login_attempt=1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 Referer: https://www.facebook.com/?stype=lo&jlou=Afd4XBdZVheUjF5ZdeR_FAKE_C6Yb_XIfyd1gU-c9mdm8PFNa6sD31467hPQAqKkvEnyXqN_xy&smuh=4888&lh=Ac-8_&aik=naTwA Cookie: wd=1266x359;reg_fb_ref=asldkfasflkasjdfsadfsafas;etc... Host: www.facebook.com DNT: 1 Connection: keep-alive Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 timezone=240&pass={password}&lsd=AVuFRDlo&locale=en_US&lgnrnd=050614_qu39&lgnjs=1402221972&email={EMAIL}&defalt_persistent=1

its the response to this request that you'd want. That said facebook only leaks the name if the browser has logged into the account with that email before. It won't leak the name if its just a random email you've not logged into before. So you may be wasting your time.

I might just be able to use that GET in the PHP.
Not sure how thought.
Thank you so much, I'll keep on looking! Smile


RE: get_file_contents php - RaccoonCity_mybb_import13707 - 06-08-2014

(06-08-2014, 11:13 AM)dropzon3 Wrote: A login to facebook looks something like:

Code:
POST /login.php?login_attempt=1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 Referer: https://www.facebook.com/?stype=lo&jlou=Afd4XBdZVheUjF5ZdeR_FAKE_C6Yb_XIfyd1gU-c9mdm8PFNa6sD31467hPQAqKkvEnyXqN_xy&smuh=4888&lh=Ac-8_&aik=naTwA Cookie: wd=1266x359;reg_fb_ref=asldkfasflkasjdfsadfsafas;etc... Host: www.facebook.com DNT: 1 Connection: keep-alive Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 timezone=240&pass={password}&lsd=AVuFRDlo&locale=en_US&lgnrnd=050614_qu39&lgnjs=1402221972&email={EMAIL}&defalt_persistent=1

its the response to this request that you'd want. That said facebook only leaks the name if the browser has logged into the account with that email before. It won't leak the name if its just a random email you've not logged into before. So you may be wasting your time.

I'm going to use some of these websites too!

pipl - pipl.com/search/?Email={$email}&CategoryID=4&Interface=1

Google Dorks (Allintext)
- https://www.google.se/?gfe_rd=cr&ei=9TiUU4-sMZPANICVgEg#q=allintext:{$email}

Google Dorks (Allinurl:user/) - https://www.google.se/?gfe_rd=cr&ei=9TiUU4-sMZPANICVgEg#q=allinurl:user/{$email}

etc etc