<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nessio.de &#124; Bennis Blog &#187; fclose</title>
	<atom:link href="http://nessio.de/tag/fclose/feed/" rel="self" type="application/rss+xml" />
	<link>http://nessio.de</link>
	<description>Rund ums Web - Tools, Apps, Tipps &#38; Tricks</description>
	<lastBuildDate>Fri, 11 May 2012 16:37:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Auf .htaccess passwortgeschützte Seiten mit PHP zugreifen</title>
		<link>http://nessio.de/2009/04/auf-htaccess-passwortgeschutzte-seiten-mit-php-zugreifen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auf-htaccess-passwortgeschutzte-seiten-mit-php-zugreifen</link>
		<comments>http://nessio.de/2009/04/auf-htaccess-passwortgeschutzte-seiten-mit-php-zugreifen/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 12:48:43 +0000</pubDate>
		<dc:creator>Benni</dc:creator>
				<category><![CDATA[Dev / Codeschnipsel]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[fclose]]></category>
		<category><![CDATA[Funktion]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Timeout]]></category>

		<guid isPermaLink="false">http://blog.nessio.net/?p=70</guid>
		<description><![CDATA[Mal wieder ein aktuelles Problem aus dem alttag. Eine Webseite wird mittel .htaccess geschützt, wie kann man trotzdem an geschützte PHP-Seiten rankommen? Auf der Suche nach der Funktion bin ich auf folgendes Script gestoßen welches Ohne Probleme funktioniert und die .htaccess Anmeldung übernimmt. Konfiguration der Parameter 1 2 3 4 $host = &#34;domain.tld&#34;; // Dein [...]]]></description>
			<content:encoded><![CDATA[<p>Mal wieder ein aktuelles Problem aus dem alttag. Eine Webseite wird mittel .htaccess geschützt, wie kann man trotzdem an geschützte PHP-Seiten rankommen? Auf der Suche nach der Funktion bin ich auf folgendes Script gestoßen welches Ohne Probleme funktioniert und die .htaccess Anmeldung übernimmt.</p>
<p>Konfiguration der Parameter</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;domain.tld&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Dein Host, z.B. admin.server.de oder geheim.de</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/geheim/index.html&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Die URI, auf die dann zugegriffen werden soll</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Benutzername vom .htaccess</span>
<span style="color: #000088;">$pw</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;testpwd&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Passwort vom .htaccess</span></pre></td></tr></table></div>

<p>Der eigentliche Script Inhalt</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errno</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errstr</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 80 = Port, 5 = Timeout</span>
<span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;GET &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; HTTP/1.1rn&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Host: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$host</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;rn&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Authorization: Basic &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;rn&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Connection: closernrn&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4096</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Antwort lesen</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://nessio.de/2009/04/auf-htaccess-passwortgeschutzte-seiten-mit-php-zugreifen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

