GIGJ.COM
welcome to my space
X
Search:  
Welcome to:gigj.com
 HOME   perl script to read secure directory html using authorization_basic

perl script to read secure directory html using authorization_basic

Published by: admin 2010-03-15
  • The following is a perl code I'm trying to write, to get html page from a secure directory using the user and password. I get an error "Authorization Required" ... I have the right user and password (it's my own server) Any clue??? #!/usr/bin/perl use LWP::UserAgent; $ua = new LWP::UserAgent; my $req = HTTP::Headers->new; $req = HTTP::Request->new(GET => 'http://www.domain.com/dir'); $req->authorization_basic("user", "password"); print "Content-type: text/htmlnn"; print $ua->request($req)->as_string;


  • Hi, From your code example, here are the offending lines. $req = HTTP::Request->new(GET => 'http://www.domain.com/dir'); $req->authorization_basic("user", "password"); first add the / to the end of the string here. "dir" is not what we are after, we are after the directory in dir $req = HTTP::Request->new(GET => 'http://www.domain.com/dir/'); take the double quotes off and replace them with single quotes here. $req->authorization_basic('user', 'password'); A better choice is to send variables my $UName = 'user'; my $Pass = 'password'; $req->authorization_basic($UName, $Pass); Something that is not required, but when I have the odd problem with this setup I do because it works, is to set the cookie attribute as well. Again, normally this is not required, but for some reason, on some setups, it works when you do and doesn't when you don't. But from your code example given above, those are your problems right now. If you need further help with this, just let me know with the clarification request and I'll be happy to help you out. I'm sure you have these links but just in case you don't lwpcook http://cpan.uwinnipeg.ca/htdocs/libwww-perl/lwpcook.html LWP::UserAgent http://cpan.uwinnipeg.ca/htdocs/libwww-perl/LWP/UserAgent.html webadept-ga
  • 15 Seconds : How to Send Secure Mail in ASP-Based E-Commerce ::
    Customers don't want to use automatic on-line credit card authorization, any additional software to read their secure mail, or install any plug-ins. Place the following script (let's call it SaveCert.asp) into this virtual directory. .. DevMailer adds SMTP email sending abilities to ASP or Perl programs.
    http://www.15seconds.com/issue/991217.htm
    HOME


  • I tried all these thing already. They don't work. I tried them again today. I read the links you sent me before already but it still doesnt seem to work. Did you ever do it, or do you have a tested script that works?


  • Hi, Yes I have and yes I do :-) Let's go over the Apache setup. Did you set this up with an .htaccess file? or through the httpd.conf file? I am assuming you can log in by going to the page directly. If you can post the setup for the directory here we can rule that out, and I'll set up a test area for you in the mean time on another server so we can test it there. Take me a bit to get that setup as I don't have access at the moment but I'll do it sometime tonight or early in the morning so we can get you up and working there. So post your setup here for the directory and I'll get my part done. webadept-ga

  • EC-Council | EC-Council Certified Secure Programmer::
    o Java Authentication and Authorization Service (JAAS) . Step 2: Create And Configure The Virtual Directory; Step 3: Create The Sample Pages . o Revealing HTML Comment Vulnerability Logging Into a Secure Web Site with Perl Script .. Using Oracle Label Security with a Distributed Database
    http://www.eccouncil.org/Course-Outline/ECSP.htm
    HOME

  • I'm sure I don't have to tell you this, but you don't have to send IP addresses, URL names, user names or passwords... just make sure the username and password (for right now) are lower case and all one word. webadept-ga


  • I created a test directory http://www.tzintz.com/test/ user and password is test


  • Okay, so something else is definitly not working on your system here http://www.webadept.net/cgi-bin/test.cgi Because that works, and I used the code I've already sent you, exactly the same. Test and see that you can see the output. So, can you describe 'what' it is doing that is not working? First off, if you are using it as a cgi, try runing the perl script from the command line, and see if that works. If it does, then it is probably your cgi file permissions that are screwy. Make sure the CGI is set at 755. Next, check your apache log files. Clear them first, and then run the perl script, and see what it says afterwards. let me know and I'll help you get this working ... webadept-ga


  • Oh.. I didn't add the cookie in the code.. here's the code that the test.cgi is running. --- #!/usr/bin/perl use LWP::UserAgent; $ua = new LWP::UserAgent; my $req = HTTP::Headers->new; $req = HTTP::Request->new(GET => 'http://www.tzintz.com/test/'); $req->authorization_basic("test", "test"); print "Content-type: text/htmlnn"; print $ua->request($req)->as_string; ---- Also, check the little things like the she-bang is the first thing on the first line and that the perl it is pointing to is the right one and all that other stuff. I know it sounds silly and obvious but you have no idea how much hair I've lost over a missing ";" .. :-) webadept-ga


  • Hi again, Just letting you know that I'm going to be out for most of the afternoon, but I'll check as I can during the day to see if you have posted something (like your apache error_log) or have any other questions regarding this. I will check and keep the email up this evening as well. You are appear to be running Apache on Linux or Unix, so this isn't an issue, but there is an issue with IIS and LWP when doing this on the local machine. Just to check your setup, if you are using the URL localhost, try using the full URL and see if that helps you out at all. webadept-ga


  • Thank you so much, the test is working but the main directory I need is not. Can you check if the following is working by you. http://www.tzintz.com/stats/ users, passwords: test


  • No problem and it is working fine from my laptop and my server as a CGI program. http://www.webadept.net/cgi-bin/test2.cgi ---- Code ---- #!/usr/bin/perl use LWP::UserAgent; $ua = new LWP::UserAgent; my $req = HTTP::Headers->new; $req = HTTP::Request->new(GET => 'http://www.tzintz.com/stats/'); $req->authorization_basic('test', 'test'); print "Content-type: text/htmlnn"; print $ua->request($req)->as_string; ---- End Code ---- You also might check to see that there are no empty blank lines after the last line of your code, and that your script is formated in Unix format, not windows format. That last one is a real rub, ... drove me mad more than once. webadept-ga





  • Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about perl script to read secure directory html using authorization_basic , Please add it free.
  • how to process unsigned wap push with pocketpc2003 smartphone2003 push router
  • sql statement
  • image processing
  • connection to sql with vb6
  • vb6 error message
  • excel macro to match debits with credits using the transaction number
  • need cgi programming help
  • display a access chart inside vb6 application
  • memory leak memory problem win net
  • unix file update events
  • set form action property with javascript in ie6
  • create a database driven inventory
  • self extracting zip file from vb code
  •  
  • jam agents program
  • vb6 find record
  • call a page from other website
  • excel script or macro automatically opening excel document and saving as xml
  • changing xsl stylesheet from javascript
  • translating excel spreadsheets into relational database tables
  • fileupload perl 5 8 6 cgi 3 07 it did worked in perl 5 6 1
  • development strategy for cross platform educational software
  • how to impliment a craigslist com like email relay in c
  • optimum database architecture
  • exporting sql data into access table
  • how to detect whether cursor is over a rotated translated rectangle in net
  • 24 bit unsigned int in
  • mdi child vb6 question

  • About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 gigj.com All Rights Reserved
    Site made&Support support@gigj.com    E-mail: web@gigj.com