# PHP: fopen() and fread()

**URL:** https://forum.kirupa.com/t/php-fopen-and-fread/139835
**Category:** Uncategorized
**Created:** [March 6, 2005, 5:47am UTC](https://forum.kirupa.com/t/php-fopen-and-fread/139835 "2005-03-06T05:47:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SmoothDime](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@SmoothDime](https://forum.kirupa.com/u/SmoothDime)
#### Post date: [March 6, 2005, 5:47am UTC](https://forum.kirupa.com/t/php-fopen-and-fread/139835/1 "2005-03-06T05:47:09Z")

</div>

hi,

in my application there is a code block that looks something like this:

```php

$fp = fopen($rssURL,"r") 
 
while ($data = fread($fp, 4096))
{
	//process data
}

```

the $rssURL is the location of an rss file on some website’s server.

so my question is: when does fopen() and/or fread() time out? is there any way to detect this? i don’t want my script to sit there for hours trying to open one 2K file? can i set the limit?

thanks
