<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1012508" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1012508</link>
    <description></description>
    <language>en</language>
          <item>
    <title>LWP</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/basic-authentication-workaround#comment-1072326</link>
    <description> &lt;p&gt;Hi guys,&lt;/p&gt;
&lt;p&gt;Thanks, I looked into the LWP function and constructed a routine that certainly does grab pages and write them to a file but even though I now know the constructor that authenticates, I need some help inserting it into the routine below:&lt;/p&gt;
&lt;p&gt;-----------------&lt;/p&gt;
&lt;p&gt;#!/usr/bin/perl&lt;/p&gt;
&lt;p&gt;use LWP::UserAgent;&lt;br /&gt;
use HTTP::Request;&lt;br /&gt;
use HTTP::Response;&lt;/p&gt;
&lt;p&gt;$FILE=&quot;d:/Inetpub/mydomain/import.htm&quot;;&lt;/p&gt;
&lt;p&gt;my $ua = new LWP::UserAgent;&lt;br /&gt;
my $request = new HTTP::Request(&#039;GET&#039;, &#039;http://www.mydomain.com/index.htm&#039;);&lt;br /&gt;
my $response = $ua-&amp;gt;request($request, $FILE);&lt;br /&gt;
if ($response-&amp;gt;is_success) {&lt;br /&gt;
     print $response-&amp;gt;content;&lt;br /&gt;
} else {&lt;br /&gt;
     print $response-&amp;gt;error_as_HTML;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;exit;&lt;/p&gt;
&lt;p&gt;-------------------&lt;/p&gt;
&lt;p&gt;Here is the authetnication:&lt;/p&gt;
&lt;p&gt;$ua-&amp;gt;credentials(&#039;www.mydomain.com&#039;, &#039;realm&#039;, &#039;username&#039;, &#039;password&#039;); &lt;/p&gt;
&lt;p&gt;In the Perl help files it says that you can use $request like this:&lt;/p&gt;
&lt;p&gt;request($request [, $subroutine]);&lt;/p&gt;
&lt;p&gt;$subroutine being the authentication call.. but whenever I try to build the authentication call above into $subroutine it just comes up with a syntax error for the &quot;&#039;&quot;, or just doesn&#039;t do anything and returns 401 access denied.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Denise &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 05 Oct 2000 19:34:14 +0000</pubDate>
 <dc:creator>Denise</dc:creator>
 <guid isPermaLink="false">comment 1072326 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/basic-authentication-workaround#comment-1072310</link>
    <description> &lt;p&gt;I think I agree with Rob.  The LWP module should allow you to use the authentication format I gave you...as it simply calls a URL.&lt;/p&gt;
&lt;p&gt;Richard&lt;/p&gt;
 </description>
     <pubDate>Thu, 05 Oct 2000 13:22:29 +0000</pubDate>
 <dc:creator>richjb</dc:creator>
 <guid isPermaLink="false">comment 1072310 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/basic-authentication-workaround#comment-1072288</link>
    <description> &lt;p&gt;It wouldn&#039;t, because Perl has no idea that you&#039;re trying to connect to an httpd there.  I believe that LWP allows you to set Username and Password for basic authentication.&lt;/p&gt;
 </description>
     <pubDate>Thu, 05 Oct 2000 00:06:51 +0000</pubDate>
 <dc:creator>roBofh</dc:creator>
 <guid isPermaLink="false">comment 1072288 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Authentication</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/basic-authentication-workaround#comment-1072261</link>
    <description> &lt;p&gt;Hi Richard,&lt;/p&gt;
&lt;p&gt;Thanks for the advice but it didn&#039;t work.&lt;/p&gt;
&lt;p&gt;I made $host = &quot;myusername:mypassword\@mydomain.com&quot;;&lt;br /&gt;
but it didn&#039;t recognize the url and died.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt;Denise&lt;/p&gt;
 </description>
     <pubDate>Wed, 04 Oct 2000 20:36:22 +0000</pubDate>
 <dc:creator>Denise</dc:creator>
 <guid isPermaLink="false">comment 1072261 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/basic-authentication-workaround#comment-1072243</link>
    <description> &lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://USER:PASSWORD@yourdomain.com&quot; class=&quot;bb-url&quot;&gt;http://USER:PASSWORD@yourdomain.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I guess all you would need to do is change $host to reflect the above format.&lt;/p&gt;
&lt;p&gt;Hope that helped. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Richard&lt;/p&gt;
 </description>
     <pubDate>Wed, 04 Oct 2000 14:05:29 +0000</pubDate>
 <dc:creator>richjb</dc:creator>
 <guid isPermaLink="false">comment 1072243 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
