Before the advent of Google Reader, I was actively reading a friend tape on Livejournal.com. And then habr appeared. And then a bunch of interesting standalone blogs.
Gradually greader became the main newsreader tool. And with the discovery of Yahoo Pipes, the quality of my tapes has increased significantly.
Pipes allowed filtering several tapes only for topics of interest to me, allowed filling the description field in those tapes where the authors for some reason did not begin to fill them (news from IRN.ru, Computerry tape), and much more.
But there was a barrel of honey and a fly in the ointment. Neither Pipes nor Google Reader can do digest authentication. Pipes can only basic, greader can not and that. And digest is the only type of authentication that Livejournal.com supports.
Therefore, attempts to log in to LJ and read tapes with sub-castle records were doomed to failure.
It was necessary to periodically go into the tape and see if any of the friends had written anything “under lock and key”.
Yes, there are services on the Internet a la
http://freemyfeed.com,
solving this problem, but will you trust anyone on the Internet a username and password from your LiveJournal? Yes, and how to integrate with the services of this service I could not think of. But a blessing in disguise: the author revealed the source codes of the scripts. Armed with patience and a php manual, I wrote my own script, remove-authentication.php, on the basis of the freemyfeed source code, which does one simple thing: replaces digest authentication with basic.
With it, the following constructions become possible:
http: // user: pass@my.server/remove-authentication.php? feed = feed-url
And this thing is perfectly integrated with pipes.
Who needs it, take it. And read LJ in Google Reader. )
UPD: the code should be saved as remove-authentication.php and put on any server that supports php :) Ideally, your own.UPD2: moved to the blog RSS<?php
if (!isset($_SERVER[ 'PHP_AUTH_USER' ])) {
header( 'WWW-Authenticate: Basic realm="My Realm"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo ' - USER:PASS@SERVER.RU/remove-authentication.php?feed=FEED-URL' ;
exit;
} else {
if (isset ($_GET[ 'feed' ])) {
header( "Content-Type: text/html; charset=utf-8" );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_GET[ 'feed' ] . '?auth=digest' );
curl_setopt($ch, CURLOPT_AUTOREFERER, true );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD,strtolower($_SERVER[ 'PHP_AUTH_USER' ] . ':' . $_SERVER[ 'PHP_AUTH_PW' ]));
$data = curl_exec($ch);
curl_close($ch);
} else {
echo ' - USER:PASS@SERVER.RU/remove-authentication.php?feed=FEED-URL' ;
exit;
}
}
?>
* This source code was highlighted with Source Code Highlighter .
')
PS: this is my first php code, constructive criticism is welcome :)