Question

my perl curl download sctript does not download file

Asked by: MatthewF

I have perl curl scrip tot download an https file. Please do not recommend another method, I am tied to this method.  Additionally, I do not have a certificate to use as well. The script is able to log in but is does not put the file.  Filename3 contains

HTTP/1.1 200 OK
Date: Mon, 29 Dec 2008 16:06:37 GMT
Server: SecureTransport/4.7
Set-Cookie: FDX=asfdafdafafasfd; path=/; Secure
Accept-Ranges: bytes
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Features: CHPWD;RTCK;STCK;ASC;DNDISP
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8

Virtual user username1 logged in.

$get=`/usr/local/bin/curl -C -O -i -k -u username1:password -O https://secureserver.com/filename3`;

                                  
1:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-12-29 at 08:13:24ID24013349
Tags

perl curl

Topic

Perl Programming Language

Participating Experts
3
Points
500
Comments
27

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Can't run CURL command from within perl script....w…
    #!/usr/local/bin/perl use Shell; curl www.google.com > p.txt for $i (1,2,3,4,5) { print "$i\n" } ======================================== When I run the above perl script, I get this error message: syntax error at first.pl line 8, near "$i (&...
  2. Apache, mod_perl and utf-8
    Hy all I'm getting crazy with mod_perl and utf-8. I already did everything that I found in the web about this and nothing works. use Encode; use utf8; sub handler() { my $r = shift; $r->content_type('text/html; charset=utf-8'); my $output = "<html><bo...
  3. making a curl call from perl
    Hi Is there an easy way to make a curl call from a perl program to fetch a file #!/usr/local/bin/perl use strict; my $cmd = `curl http://localhost/entrypoint?arg1=a`; the above did not work for me can i get the file fetched in a variable? that i can use in the code. it ...
  4. Perl script / Curl
    I need a Perl script or curl command that searches google.com for a given string...been thru all kinds of documentation on curl and coming up with nothing...can anyone help?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: DropZonePosted on 2008-12-30 at 05:48:49ID: 23262422

If you want to "PUT" the file, you need the -T option.

     -dZ.

 

by: MatthewFPosted on 2008-12-30 at 05:55:58ID: 23262474

I am doing a GET, download, not a put

 

by: DropZonePosted on 2008-12-30 at 07:11:54ID: 23263044

Sorry, I misread your comment where it said "[t]he script is able to log in but is does not put the file".

You need to specify the output file with the "-o" option (that's a lower-cased letter "oh").

    -dZ.

$get=`/usr/local/bin/curl -o output.html -i -k -u username1:password -O https://secureserver.com/filename3`;

                                              
1:

Select allOpen in new window

 

by: MatthewFPosted on 2008-12-30 at 11:59:59ID: 23265411

the only create a status of my login, not the actual file i need.

 

by: DropZonePosted on 2008-12-30 at 12:07:23ID: 23265521

Works over here (of course, I used a different URL of mine).

You included the "-i" option, which tells curl to include the HTTP header in the output file.  However, the payload should also be there.  The output, in my example, will go to a file called "output.html".

    -dZ.

 

by: MatthewFPosted on 2008-12-30 at 12:34:00ID: 23265793

when I run
$get=`/usr/local/bin/curl -o output.txt -k -u username1:password -O https://secureserver.com/filename3`;

output.txt is

Virtual user username1 logged in.

 

by: DropZonePosted on 2008-12-30 at 12:48:10ID: 23265907

I don't know what to say.  Below is my script, verbatim, except for the user/pwd string.

After executing the script, the output.txt file contains the index.html.

Can you post your full perl script (if you have any other code)?  Also, which version of curl are you using?  I'm using curl 7.16.3, compiled for cygwin.

By the way, if you use -O (upper-cased "oh"), instead of -o (lower-cased "oh"), curl will save to a filename with the same name as the source, so there is no need to specify an output filename.

     -dZ.

#!/usr/bin/perl
 
$get=`/usr/bin/curl -o output.txt -k -u username:password -O https://www.techunlimited.net/books/index.html`;
                                              
1:
2:
3:

Select allOpen in new window

 

by: MatthewFPosted on 2008-12-30 at 12:54:13ID: 23265955

Could it be the location of the file? What I mean is when I manually login into my site I see the file. However, do I assume that on my site it is merely the url name and file ?  ie https://secureserver.com/filename3

 

by: DropZonePosted on 2008-12-30 at 13:31:42ID: 23266265

It could be the location of the file; however, I don't see why it would tell you "user logged in" without an error or output, unless that *is* the output.

When I try that URL, I get a 404 error: "/filename3 was not found on this server".

Is there a query string value that is being processed by an application on the back-end?

How do you access the file "manually"?

   -dZ.

 

by: MatthewFPosted on 2008-12-30 at 13:40:45ID: 23266343

I did not provide the actual url or username or password. When I manually log into the site i see my file and have the ability to upload or download files

 

by: DropZonePosted on 2008-12-30 at 13:46:04ID: 23266391

I understand.  But my question remains:  when you "see" the file, is it a hyperlink to a physical file, a javascript function, a hyperlink with QueryString parameters, or something else?   Also, have you analysed the HTTPS transaction when you download the file to see if there is any redirection involved?

     -dZ.

 

by: MatthewFPosted on 2008-12-30 at 13:55:54ID: 23266479

I am not clear as how to determine your question. when i click on the file name it windows popup box prompts me to save it or open the file.  How can i determine if there are any redirects?

 

by: DropZonePosted on 2008-12-30 at 14:25:29ID: 23266706

Sorry for the confusion.  If you View|Source of the page, is the link to the file a straight anchor hyperlink, or is it a call to a server script with paramters?

To determine if there are any redirects, you could use, for example, the Firefox extension "HTTP Headers", or a TCP/IP debugger, like WireShark.

In a pinch, you could try disabling redirects in the browser (typically possible in developer browsers, such as Firefox, Opera, or Safari; I'm not sure if IE offers this) and see what it does.

    -dZ.

 

by: ahoffmannPosted on 2008-12-31 at 04:50:59ID: 23269524

I guess you need to pass another user agent
Also: why do you use backticks in your perl script?

 

by: MatthewFPosted on 2008-12-31 at 05:21:03ID: 23269640

The source for the download is :

          <SCRIPT>PrintFileURL("filename3", "filename4", 0, "110550", "Dec 30 14:50 ", "/icons/default.gif")</SCRIPT>

<SCRIPT>PrintFileURL("filename3", "filename3", 0, "411274", "Dec 30 14:50 ", "/icons/default.gif")</SCRIPT>

Additioanlly, Firefox hhtp headers did not indicate a redirect

 

by: DropZonePosted on 2008-12-31 at 05:35:19ID: 23269695

So, it is as I thought: a JavaScript function that performs the download.  You'll have to track down the PrintFileURL() function to see how it is doing this and which path it is actually using.

If you post the code to this routine, we may be able to help you analyse it.

    -dZ.

 

by: MatthewFPosted on 2008-12-31 at 05:54:38ID: 23269771

here is the source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Directory of /</title>
  <script language="JavaScript" src="/scripts/include_list_html.js" type="text/javascript"></script>
  <script language="JavaScript" type="text/javascript">
    var stParamUseJap=false;
    var unicode=false;
    var fdx_skin  = 'jb9';
  </script>
  <script language="JavaScript" src="/scripts/st.js" type="text/javascript"></script>
 
      <script language="JavaScript" type="text/javascript">
        function PrintServerInfo(name, ver, build, host) {
          document.write('<b>Server</b> ',host.toLowerCase(),'<br/>');
        }
      </script>
      <link rel="stylesheet" type="text/css" href="/html/jb9.css"/>
    </head>
    <body topmargin="10"   rightmargin="0" marginwidth="0" marginheight="10" bottommargin="0" leftmargin="0"  bgcolor="#ffffff">
      <table border="0" cellpadding="0" cellspacing="0" width="800" align="center">
        <tr><td colspan="5" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
        <tr>
          <td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
 
          <td width="9" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
          <td width="780" nowrap>
            <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
              <tr><td height="5" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
              <tr><td nowrap>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                  <form name="STform" autocomplete="off" method="post" enctype="application/x-www-form-urlencoded">
                    <input type="hidden" name="switch">
                  </form>
 
                  <tr>
                    <td rowspan="3" width="200" valign="bottom">
                      <img src="/icons/citiLogo.gif" border="0" alt="" width="140" height="45">
                    </td>
                    <td colspan="6">
                      <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                          <td width="50" class="tx1" valign="top">&nbsp;</td>
                          <td height="60" align="center" class="tx2">Welcome to CitiSFT</td>
 
                          <td width="250" align="right" class="tx1" valign="top">
                            <SCRIPT> PrintServerInfo("SecureTransport", "4.7", "3041", "citisft-edge-uat-d01.namdmz.dmzroot.net") </SCRIPT><br>
                            <a class="tx1" href="/?logout" onMouseOver="window.status='Logout';return true ">Logout</a>
                          </td>
                        </tr>
                      </table>
                    </td>
                  </tr>
 
                  <tr><td colspan="5" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td colspan="1" height="1"                   nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                  </tr>
                  <tr>
                      <td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td width="90" class="tx0" align="center"><a class="tx0" href="/?T">My Files</a></td>
                      <td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td width="90" class="tx0" align="center"><a class="tx0" href="javascript:STpost('Change Password')">My Account</a></td>
 
                      <td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td width="397"                 nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                  </tr>
                  <tr><td colspan="2" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td colspan="1" height="1"                   nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                      <td colspan="4" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                  </tr>
                </table>
              </td></tr>
 
              <tr><td height="5" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
              <!-- <tr><td height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr> -->
              <tr><td height="5" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
              <tr><td>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td align="left" valign="top" width="200">
        <table border="0" bordercolor="#999999" cellpadding="0" cellspacing="0" width="200">
          <tr>
 
            <td width="20" valign="top" class="tx0"><b>mode&nbsp;</b></td>
            <td>
              <table border="0" cellpadding="0" cellspacing="0" width="123">
                <tr><td colspan="5" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
                <tr>
                  <td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
                  <script>
                    function PrintXferMode(ascii) {
                      if (ascii) {
                        document.write(
                          '<td width="60"class="tx0"><a class="tx0" href="javascript:STpost(\'Set Binary\')">binary</a></td>',
                          '<td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>',
                          '<td width="60"class="rx0">ascii</td>',
                          '<td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>'
                        );
                      } else {
                        document.write(
                          '<td width="60"class="rx0">binary</td>',
                          '<td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>',
                          '<td width="60"class="tx0"><a class="tx0" href="javascript:STpost(\'Set ASCII\')">ascii</a></td>',
                          '<td width="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>'
                        );
                      }
                    }
                  </script>
                  <SCRIPT> PrintXferMode(0) </SCRIPT>
 
                </tr>
                <tr><td colspan="5" height="1" bgcolor="#999999" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
              </table>
            </td>
          </tr>
          <tr><td colspan="2" height="5" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
          <tr>
            <td width="20" valign="top" class="tx0"><b>path&nbsp;</b></td>
 
            <td>
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <script>
                  function ParentDirFunc(name,url) {
                    var names = name == '/' ? [''] : name.split('/');
                    var urls = name == '/' ? [''] : url.split('/');
                    var purl = '/';
                    var pname = '';
                    for (var i = 0; i < names.length; i++) {
                      var icon  = (i == names.length-1) ? '/icons/dircurr.gif' : '/icons/dirpath.gif';
                      var pname = (i == 0) ? '/' : names[i];
                      var purl  = urls.slice(0,i+1).join('/');
                      document.write(
                        '<tr>',
                          '<td class="tx0">',
                            '<a class="tx0" href="',purl,'/?T"><img border="0" alt="" src="',icon,'">&nbsp;',pname,'</a>',
                          '</td>',
                        '</tr>'
                      );
                    }
                  }
                </script>
                <SCRIPT> ParentDirFunc("/", "/") </SCRIPT>
              </table>
            </td>
          </tr>
          <tr><td colspan="2" height="5" nowrap><img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
 
          <script>PrintUploadForm()</script>
            <tr>
              <td width="20" valign="top" rowspan="2" class="tx0"><b>file&nbsp;</b></td>
              <td align="right"><input class="bu0" type=file name="File" size=15></td>
            </tr>
            <tr><td align="right">
  <input type="button" class="bu0" value="Upload File" onclick="javascript:if (document.STupload.File.value.length>0)document.STupload.submit(); else alert('Please enter a file to upload');document.STupload.File.focus();"
         onmouseover="window.status='Upload File'; return true;"
         onmouseout="window.status=''; return true;">
            </td></tr>
 
          </form>
        </table>
      </td>
      <td width="5" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
      <td width="1" bgcolor="#999999" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
      <td width="5" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
      <td valign="top">
        <!-- directory listing -->
        <table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
 
          <tr><td width="20" nowrap align=left class="tx0">&nbsp;</td>
              <td class="tx1"><b>Name</b></td>
              <td class="tx1"><b>Size</b></td>
              <td class="tx1"><b>Date</b></td>
          </tr>
          <script>
            files.type='radiox';
            function PrintFileURL(url,name,dir,size,date,icon) {
              var i = files.n();
              files.add(name,url,0,dir?'directory':'file');
              if (i % 5 == 0) {
                document.write(
                  '<tr><td colspan="4" height="1" bgcolor="#999999" nowrap>',
                        '<img src="/icons/jb9/1.gif" border="0" alt="" width="1" height="1">',
                  '</td></tr>');
              }
              <!-- column 0: checkbox -->
              document.write(
                '<tr>',
                  '<td width="20" nowrap align=left class="tx0">',
                    '<img border="0" alt="" src="/icons/jb9/c0.gif" id="f_',files.n()-1,'"',
                         'onmouseover="style.cursor=\'hand\'" onmouseout="style.cursor=\'default\'" onclick="files.clickit(\'',i,'\')">',
                  '</td>');
              <!-- column 1: download link -->
              document.write('<td nowrap align=left class="tx0">');
              if (dir) {
                document.write(
                    '<a class="tx0" href="',url,'/?T">');
              } else {
                document.write(
                    '<a class="tx0" href="javascript:ActiveXDownload(\'',name,'\',\'',url,'\')"',
                       'onMouseOver="window.status=\'Download ',name,'\';return true"',
                       'onMouseOut="window.status=\'\';return true">');
              } 
              document.write(
                      '<img border="0" alt="" src="',icon,'">&nbsp;',name,
                    '</a>',
                  '</td>');
              <!-- column 2: size -->
              document.write(
                  '<td nowrap align=left class="tx0">',(dir?'&nbsp;':size),'</td>');
              <!-- column 3: date -->
              document.write(
                  '<td nowrap align=left class="tx0">',date,'</td>',
                '</tr>');
            }
          </script>
          <SCRIPT>PrintFileURL("filename4", "filename4", 0, "110550", "Dec 30 14:50 ", "/icons/default.gif")</SCRIPT>
 
<SCRIPT>PrintFileURL("filename3", "filename3", 0, "411274", "Dec 30 14:50 ", "/icons/default.gif")</SCRIPT>
 
          <tr><td colspan="4" height="1" bgcolor="#999999" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
          <script>
            if (files.n() > 0) {
              document.write(
                '<tr><td colspan="4" height="5" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>',
                '<tr>',
                  '<td nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>',
                  '<td class="tx0" colspan="3" nowrap>',
                    '<input type="button" style="width:90" class="bu0" ',
                           'onclick="f_check(\'D\',true,true,false)" value="Delete">&nbsp;&nbsp;&nbsp;',
                    '<input type="button" style="width:90" class="bu0" ',
                           'onclick="f_check(\'B\',false,false,false)" value="Download">&nbsp;&nbsp;&nbsp;',
                    '<input type="button" style="width:90" class="bu0" ',
                           'onclick="f_check(\'H\',false,false,false)" value="View (HTML)">&nbsp;&nbsp;&nbsp;',
                    '<input type="button" style="width:90" class="bu0" ',
                           'onclick="f_check(\'P\',false,false,false)" value="View (Text)">&nbsp;&nbsp;&nbsp;',
                  '</td>',
                '</tr>');
            }
          </script>
        </table>
      </td>
    </tr>
  </table>
              </td></tr>
 
              <tr><td height="5" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
            </table>
          </td>
          <td width="9" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
          <td width="1" bgcolor="#999999" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td>
        </tr>
        <tr><td colspan="5" height="1" bgcolor="#999999" nowrap><img src="../../icons/jb9/1.gif" border="0" alt="" width="1" height="1"></td></tr>
      </table>
    </body>
 
  </html>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:

Select allOpen in new window

 

by: DropZonePosted on 2008-12-31 at 06:12:21ID: 23269891

I see that the only downloadable link that is generated by PrintFileURL() is the following:

      document.write(
            '<a class="tx0" href="javascript:ActiveXDownload(\'',name,'\',\'',url,'\')"',
               'onMouseOver="window.status=\'Download ',name,'\';return true"',
               'onMouseOut="window.status=\'\';return true">');

There are two parts which I cannot decipher without further information.  They are the object "files", which is used by the function to operate on each filename; and the ActiveXDownload() method.

There are also various methods of the "files" object which are suspect, such as click_it() and add().

Since none of these things are defined in this file, I pressume they all reside within the library file "/scripts/include_list_html.js" included at the top of the document.

You could post that code in here, so that we may continue to analyse it.  But I think the easiest way would be to view the HTTP headers submitted when you click on the file to figure out which is ultimately the request being submitted.

Keep in mind that if the request is not authenticated, it may appear as two request/response cycles: one for the original request, in which the server responds with a 302 status code to request authentication; the other one to actually perform the request with the authentication information.

Perhaps you could post the HTTP transaction log here, anonymised where appropriate, of coursed.

     -dZ.

 

by: MatthewFPosted on 2008-12-31 at 06:31:25ID: 23270030

dz,
 This is an 3rd party server so I do not have access to the js scripts.  Correct me if  I'm cront but I since it's a third party server I do not think i have access to the HTTP transaction log as well.  Correct?

 

by: DropZonePosted on 2008-12-31 at 06:57:13ID: 23270249

Sorry, I should have explained with more details.  You should be able to get the JS script file by just putting its address in the address bar of your browser (following the domain of the URL, of course).  Then save it from the browser into a file.

As for the HTTP transaction log, I thought that since you mentioned Firefox's HTTP headers, that you were using the HTTP Header extension, which will show the transaction.  In any case, the Page Info|HTTP Header tab for the downloaded file should suffice.  Just view it while you have the open/save as dialog open.

    -dZ.

 

by: MatthewFPosted on 2008-12-31 at 07:33:10ID: 23270521

the header log is below.. Thanks again

https://secureserver.com/template/login
 
POST /template/login HTTP/1.1
Host: secureserver.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 YFF3 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://secureserver.com/?logout
Cookie: FDX=
Content-Type: application/x-www-form-urlencoded
Content-Length: 59
switch=Log+In&user=username&password=password1&Log+In=Log+In
HTTP/1.x 302 Found
Date: Wed, 31 Dec 2008 15:28:30 GMT
Server: SecureTransport/4.7
Set-Cookie: FDX=624e767a474e796a4b486951616c574b6d5a5sfasfd13d3d; path=/; Secure
Location: /
Keep-Alive: timeout=15
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
https://secureserver.com/
 
GET / HTTP/1.1
Host: secureserver.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 YFF3 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://secureserver.com/?logout
Cookie: FDX=624e767a474efadsfasf51616c574b6d5a536d45513d3d
 
HTTP/1.x 200 OK
Date: Wed, 31 Dec 2008 15:28:32 GMT
Server: SecureTransport/4.7
Accept-Ranges: bytes
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Features: CHPWD;RTCK;STCK;ASC;DNDISP
Keep-Alive: timeout=15
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
https://secureserver.com/filename3?B
 
GET /filename3?B HTTP/1.1
Host: secureserver.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 YFF3 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://secureserver.com/
Cookie: FDX=624e767a47afdssafdasfdsadfsadf536d45513d3d
If-Modified-Since: Tue Dec 30 14:50:02 2008
 
HTTP/1.x 200 OK
Date: Wed, 31 Dec 2008 15:28:41 GMT
Server: SecureTransport/4.7
Accept-Ranges: bytes
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Features: CHPWD;RTCK;STCK;ASC;DNDISP
Last-Modified: Tue, 30 Dec 2008 14:50:03 GMT
content-disposition: attachment; filename="filename3"
Content-Length: 110550
Keep-Alive: timeout=15
Connection: Keep-Alive
Content-Type: application/octet-stream
----------------------------------------------------------
https://secureserver.com/?logout
 
GET /?logout HTTP/1.1
Host: secureserver.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 YFF3 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://secureserver.com/
Cookie: FDX=624e767a4wfdasfsafasfsafsab6d5a536d45513d3d
 
HTTP/1.x 200 OK
Date: Wed, 31 Dec 2008 15:29:00 GMT
Server: SecureTransport/4.7
Set-Cookie: FDX=; path=/; Secure
Accept-Ranges: bytes
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Features: CHPWD;RTCK;STCK;ASC;DNDISP
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:

Select allOpen in new window

 

by: DropZonePosted on 2008-12-31 at 07:48:42ID: 23270651

Bingo!

I can discern a few things of note from that transcript.  First, that after logging in, you are given a Cookie called "FDX", for example:
  FDX=624e767a474e796a4b486951616c574b6d5a5sfasfd13d3d

And second, that the request includes a querystring parameter:
  GET /filename3?B

Another thing to note is that the request specifically uses HTTP 1.1, so you should make sure that your curl command string does not include the "-0" (that's a number zero), which forces the program to use HTTP 1.0.

The second point I mentioned above is easy to address: just change your URL to include the parameter:
   https://secureserver.com/filename3?B

The first one is a bit more involved.  First, I would suggest trying without cookies, just to see if you can get away with it.  But if indeed it requires a cookie, then you may need to perform two requests: one to log in and receive a cookie; and the second one to retrieve the file, with the "-B" option to include the cookie.  Note that you will need to parse the response of the first one to retrieve the cookie value (or use the "-c" option to automatically store cookies in a "cookie jar).

     -dZ.

 

by: MatthewFPosted on 2008-12-31 at 08:15:13ID: 23270871

could I bypass this issue and use sftp in curl ?  If so can i use sftp in curl that uses username and password verus a certificate?

 

by: MatthewFPosted on 2008-12-31 at 08:20:12ID: 31529396

DZ...The -b -c option did the trick.  Thanks again for you great assitance.

 

by: DropZonePosted on 2008-12-31 at 08:33:20ID: 23271046

You could, as long as the server supports sFTP.  sFTP requires an FTP server running locally on the server, which is independent from the HTTP server.

And you will need the full path to the file and permissions to access the file, as opposed to the HTTP request, where only the HTTP server requires access permissions to the file (you only require access permissions to the application).

    -dZ.

 

by: TintinPosted on 2008-12-31 at 13:00:27ID: 23273063

>sFTP requires an FTP server running locally on the server, which is independent from the HTTP server.

Not correct.  SFTP requires a SSH server with the SFTP subsystem enabled.  This is totally separate to a FTP server.

 

by: DropZonePosted on 2008-12-31 at 13:56:05ID: 23273296

Fine, but my point is that it is separate from the HTTP server, and that the fact that he is able to make HTTP requests does not mean that he will be able to replace the HTTPS requests with SFTP.  Your comment does not change this fact.

     -dZ.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...