help needed with code to copy a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vineet7kumar
Forum Newbie
Posts: 6
Joined: Sun Jun 03, 2007 3:10 pm

help needed with code to copy a file

Post by vineet7kumar »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi everyBuddy,

        I wrote a code to copy a RSS feed file from various sites...

[i]code  part to copy the file: [/i]

Code: Select all

//$rss_url1 = "http://www.digg.com/rss/index.xml";
$rss_url1 = "http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml";
$file = md5($rss_url1);
$path = "$file.xml";
copy($rss_url1,$path);
I tested it for various links ... it's working... but for the link
"http://www.digg.com/rss/index.xml"
it is not working... it is showing a error
" Warning: copy(http://www.digg.com/rss/index.xml) [function.copy]: failed to open stream: HTTP request failed! in..... "

what could be the possible reason and it's solution?

thanks and regards,
viny


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

It probably requires authentication. I also noticed the xml file has its own custom tags.

Don't know how to fix it though. My RSS reader just returns errors as well.

My guess is that it is an authentication thing.
User avatar
maliskoleather
Forum Contributor
Posts: 155
Joined: Tue May 15, 2007 2:19 am
Contact:

Post by maliskoleather »

I believe that digg blocks the PHP useragent.

you may want to look into cURL
Post Reply