|
Posted by www.j2be.com on 12/31/07 06:18
Even if the code is wrong at least it should work correctly.
The fopen and the file functions are used in the wrong manner.
If you use fopen continue to use it with a while and fgets to retrieve the
data.
Using a file() function with a join is a waste of time and code (except for
some rare cases).
The code seems to be related to a function but at least there's no trace of
the declaration of the function.
You have to remove the @ so that you can read more informations about the
error.
The rest of the code, even if simple, should be also rewritten.
You should use the error trapping or a decent http connection class to have
more errors reported so that you will be able to solve the problem in less
time.
Regards
Leonardo Armando Iarrusso
http://wwe.j2be.com
"maria" <maria@maria_de_napoli.com> ha scritto nel messaggio
news:p1vul3ll7om4b0fju32cin4b7nemutevg5@4ax.com...
> It looks like I cannot open the Open Directory of dmoz any longer. I
> am using the following code, which is very common,
>
> $fp = fopen($odpurl, "r");
> if((@$fp = fopen( $odpurl, "r" )) != false) {
> $html = join( "", file( $odpurl ) );
> fclose ( $fp );
>
> if($savecache) {
> if((@$cf = fopen( $fullpath, "w" )) != false) {
> fwrite($cf, $html);
> fclose( $cf );
> } else {
> errorMsg("Error writing to cache!<br>Make sure the cache folder exists
> and is writable by this script (you may also disable the cache)");
> }
> }
>
> } else {
> errorMsg($odpurl);
> errorMsg("Error reading data from dmoz!<br>Make sure the dmoz url is
> correct");
> }
> return $html;
>
> The $odpurl address is correct. Also, my "allow_url_fopen"
> is enabled. I don't know what is happening.
> Thank you!
>
> maria
Navigation:
[Reply to this message]
|