0

i want to read the sourcecode of another webpage and receive the following error using file_get_contents in PHP:

Warning: file_get_contents(url is here) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in file_get.php

How is this possible and is there a solution to work around this?

Thanks.

Torben
  • 5,388
  • 12
  • 46
  • 78
  • 3
    Food for thought: You won't get any response if you don't post your actual code. Actually that's not entirely true, you will get a response, some of which will end up as being "downvotes", which I for one, did NOT downvote but you can expect more till you do. – Funk Forty Niner Jul 21 '13 at 05:56
  • You could always try to use an `iframe` to "display" content, but that's not always a sure fire way. FYI: Google and other sites as such won't show up using `iframes`, if that's your intention. – Funk Forty Niner Jul 21 '13 at 06:04

1 Answers1

3

The error message sums it up nicely:

HTTP/1.1 403 Forbidden

You do not have permission to access that page. It is controlled by the host you're trying to scrape.

For more information, see HTTP 403 on Wikipedia.

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134