Re: Cannot Use "fopen" with "dmoz" Open Directory Anymore.
am 31.12.2007 07:18:55 von infoEven 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"
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!
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!
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