我正在编写一个PHP页面,通过抓取现有的HTML页面生成播客源。一切都很顺利,但我的其中一个MP3文件出现了“filesize():stat failed”错误。据我所知,该文件没有损坏,并且能够正常播放。我也已经重新上传了该文件到服务器。它的文件大小处于所有文件大小的中等范围内,因此我不认为文件过大。由于其他每个文件都返回文件大小,我认为问题在于MP3文件,而不是我的服务器配置。是否还应该检查其他内容?
下面是代码的相关部分:
下面是代码的相关部分:
$i = 1; //skipping header row on table
do {
$tr = $table->find('tr', $i);
$date = $tr->find('div', 0)->plaintext;
$datetime = new DateTime($date);
$speaker = $tr->find('div', 1)->plaintext;
$title = $tr->find('div', 2)->plaintext;
$url = $tr->find('div', 3)->find('a', 0)->href;
$fullurl = "http://domain.org/resources/".$url;
$filesize = filesize($url); //<---works on every file except one
echo "<item><title>".$title."</title>\n";
echo "<description>".$title." - ".$datetime->format('D, M jS, Y')." - ".$speaker."</description>\n";
echo "<itunes:author>".$speaker."</itunes:author>\n";
echo "<enclosure url=\"".$fullurl."\" length=\"".$filesize."\" type=\"audio/mpeg\"/>\n";
echo "<guid isPermaLink=\"true\">".$fullurl."</guid>\n";
echo "<pubDate>".$datetime->format('r')."</pubDate>\n";
echo "<itunes:explicit>clean</itunes:explicit></item>\n\n";
$i++;
}while ($table->find('tr', $i) != NULL);
根据要求:(人们会指出编辑吗?这是我在这里的第一个问题..)
文件名为“12-20-09_AM_Podcast.mp3”,遵循其他文件的命名约定,所有文件的权限均为644。完整的错误代码为
<b>Warning</b>: filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for audio/12-20-09_AM_Podcast.mp3 in <b>/homepages/1/d106955786/htdocs/victory/resources/podcast1.php</b> on line <b>45</b><br />