473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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_contents 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
Aug 23 '07 #1
5 1798
Hi,
im working on a project to scrap some contents from a page and show in our page (News sites) .

I use file_get_contents 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 ;)
Aug 23 '07 #2
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
Aug 23 '07 #3
pbmods
5,821 Expert 4TB
Heya, Learner.

Post the code that you use to call file_get_contents().
Aug 23 '07 #4
Heya, Learner.

Post the code that you use to call file_get_contents().

Expand|Select|Wrap|Line Numbers
  1. $scrap = file_get_contents("http://www.rediff.com");
  2.    echo $scrap;
Aug 24 '07 #5
code green
1,726 Expert 1GB
It is probably a particular sites security settings.
Aug 24 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob | last post by:
for some reason i keep getting : Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/rob/www/php/filegetcontents2.php on...
4
by: Aetherweb | last post by:
This is probably really obvious, sorry, been a long day... I'm wanting to create a PHP file which is a template for an email, and read the file into a string, ready to send out using my email...
0
by: pac1250 | last post by:
Hi, I am searching how to solve a problem and I dont find it :( I want to access a page from a script behind a proxy : (my script) <-(a proxy with authentification) <-(https serveur with...
6
by: Pheddy | last post by:
Hey i tried this code to get the country and IP via PHP (from: http://roshanbh.com.np/2008/07/getting-country-city-name-from-ip-address-in-php.html) function countryCityFromIP($ipAddr) {...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.