Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 06-01-2006, 04:56 PM   #1 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
file() and fopen() not loading entire file

I'm building a GUI for my remote winamp script (which uses Victor Pavlov's Snowcrash plugin)

The problem I'm running into is that I can't seem to load the entire playlist (over 2600 titles) into an array. I usually get a mere 60-70 titles loaded then it just stops. It usually stops reading half-way through a title name too, as you can see here

It's supposed to load this page into an array.

The only thing I could think of was that maybe arrays are only allowed to contain a certain number of characters? I did a character count on 5 different playlists, and the range of characters was pretty tight. Between 2560 and 2580 characters are loaded into the array before it quits reading the page.

PHP Code:
<?
    $playlist 
file("http://67.189.104.92:82/playlist?request=playlist");

    for (
$i 1$i count($playlist); $i++) {
        
$songInfo explode("|!|"$playlist[$i]);
        
$title $songInfo[1];
        
$index $songInfo[2];
        echo 
"<a class='song' href='http://67.189.104.92:82/fsnowCrashSong?request=playlist&play=$index&Back=1&calloutput=1'style='margin-left: 10px;'>$title</a><br />";
    }
?>
__________________
Current Project

Last edited by Redline; 06-01-2006 at 04:57 PM. Reason: added source code
Redline is offline   Reply With Quote
Old 06-01-2006, 06:12 PM   #2 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
Alright, well I've got it listing all 2646 song titles properly using curl() to write the contents of http://67.189.104.92:82/playlist?request=playlist to a local file, then loading the contents from the local file into an array with file(). Does anyone know why I can't use file() to load the entire content of my playlist from a remote file?
__________________
Current Project
Redline is offline   Reply With Quote
Old 06-02-2006, 01:02 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
i'm not sure why that happened. it could be a size issue with the file() function.

fopen() is mentioned in the subject, but i didn't see much in the description. i would have used a fopen() / fread() logic if i was having trouble with file() and large files.
__________________
Mike
sde is offline   Reply With Quote
Old 06-02-2006, 01:26 PM   #4 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
I tried both file, and fopen and had the exact same results with both. But they both work correctly and load the entire file when opening the file locally. When trying to access the file from my computer however, it got truncated
__________________
Current Project
Redline is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
file types: reading and writing pre_wreck Standard C, C++ 2 09-26-2005 05:49 AM


All times are GMT -8. The time now is 02:23 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting