Results 1 to 6 of 6

Thread: facebook give default page source when i fetched it with php

  1. #1
    Join Date
    Sep 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default facebook give default page source when i fetched it with php

    when ever i try to read facebook page source they give some default page source

    the title of default page stATES Incompatible Browser | Facebook..but the original title of index page is welcome to facebooK

    the code used by me is this

    PHP Code:
    <?php
    $url 
    "http://www.facebook.com";
    $str file_get_contents($url);

    echo 
    '<pre>';
    echo 
    htmlentities($str);
    ?>
    its seems like facebok is blocking this type of interaction..if that is the case then is there any other way to get facebook page source out .......because i have treid it on other site
    it works ok for it
    Last edited by mayanktalwar1988; 04-27-2010 at 12:20 PM. Reason: just nothing spelling mistakes

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Sound like (don't know for sure) it's redirecting you because it recognizes that it's a script (and not a browser) accessing the page.

    What are you trying to do, exactly?
    Quote Originally Posted by mayanktalwar1988
    is there any other way to get facebook page source out...
    If you're just interested in what it looks like, you could always visit the page and right-click.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I agree completely. It's very likely that you are violating either terms of service at facebook or just running into security precautions. If you really work around it you might be able to get a semi-working script, but what's the point? They'll probably block it after they notice what you're doing unless you're just doing this once or something.
    Due to the nature of the request, this is not the type of question we answer here.
    Note that facebook has some APIs available if you want to work with it. Check out their info.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Sep 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i just learning and figuring out things which would help me to make a crawler for a site....just started...

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Why do you need a crawler? What are you trying to accomplish?

    If you're "just learning," it's better to look at a page that has something you like, right-click, and find the appropriate code to "figure things out."

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    It'll be complex to make a crawler. Why not start on sites (like your own, for an easy example) that don't block this sort of thing? Then once you've worked out all the details you can figure out how to make it work for the sites that aren't so easy.
    But again, be careful with how you approach all of this.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •