file_get_contents functions shows error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newlearner
    New Member
    • May 2007
    • 67

    file_get_contents functions shows error

    Hi,
    im working on a project to scrap some contents from a page and show in our page (News sites) .

    I use file_get_conten ts function to get the content.
    This works fine for local url but if i give a remote url(bbc.com) as the parameter it throws error

    "failed to open stream: HTTP request failed! HTTP/1.0 400 Invalid header received from browser".

    I have no idea abt this can anybody help me....


    thanks in advance!!
    Looking forward for a early reply
  • ReekenX
    New Member
    • Aug 2007
    • 3

    #2
    Originally posted by newlearner
    Hi,
    im working on a project to scrap some contents from a page and show in our page (News sites) .

    I use file_get_conten ts function to get the content.
    This works fine for local url but if i give a remote url(bbc.com) as the parameter it throws error

    "failed to open stream: HTTP request failed! HTTP/1.0 400 Invalid header received from browser".

    I have no idea abt this can anybody help me....


    thanks in advance!!
    Looking forward for a early reply
    Hi, can you post an example url from whre you want get content, I will check it my self ;)

    Comment

    • newlearner
      New Member
      • May 2007
      • 67

      #3
      Originally posted by ReekenX
      Hi, can you post an example url from whre you want get content, I will check it my self ;)

      i've tried many urls http://www.rediff.com, http://yahoo.com http://ndtv.com etc

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Learner.

        Post the code that you use to call file_get_conten ts().

        Comment

        • newlearner
          New Member
          • May 2007
          • 67

          #5
          Originally posted by pbmods
          Heya, Learner.

          Post the code that you use to call file_get_conten ts().

          [code=php]$scrap = file_get_conten ts("http://www.rediff.com" );
          echo $scrap;[/code]

          Comment

          • code green
            Recognized Expert Top Contributor
            • Mar 2007
            • 1726

            #6
            It is probably a particular sites security settings.

            Comment

            Working...