Could you drop the allow_url_fopen requirement?
-
First of all, thanks for your plugin. I just switched to a different hoster. This hoster has disabled
allow_url_fopen
and neither allows to change this setting via.htaccess
or.user.ini
nor is willing to change this setting. As a consequence, “view” links no longer work.From what I understand, this is due to
WP_Publication_Archive::open_link()
usingreadfile()
which in turn usesfopen()
to read the content of a file from a (possibly) remote location. This seems to be deprecated, a growing number of hosters disableallow_url_fopen
.For now, I’ve applied a quick fix, replacing
readfile( $uri )
inWP_Publication_Archive::open_link()
withfsockopen
, but it’s ugly and doesn’t work (I get the HTTP headers wrong; it’s been a long day and will give up for now, maybe I’ll have another look at another time):if ( 'https://' == substr( $uri, 0, 7 ) ) { $noschema = explode( '/', substr( $uri, 7 ), 2 ); $host = $noschema[0]; $path = $noschema[1]; $socket = fsockopen( $host, 80 ); if ( $socket ) { $out = 'GET /' . $path . " HTTP/1.1\n" . 'Host: ' . $host . "\n" . "Connection: close\n\n"; fwrite( $socket, $out ); while ( ! feof( $socket ) ) { echo fread( $socket, 8192 ); } fclose( $socket ); } else { trigger_error( 'Could not connect to ' . $host, E_USER_ERROR ); } }
Of course, this fix will be gone with the next update. Could you look into this? Thanks a lot!
https://www.ads-software.com/plugins/wp-publication-archive/
- The topic ‘Could you drop the allow_url_fopen requirement?’ is closed to new replies.