Jump to content

Download a file from an image


Floppy
 Share

Recommended Posts

Hello,

Is possible to download a file from URL (href) from an image?

For example, if I have this html code...

<a href="/admin/cst/download.php?customer_id=3361368&id=LSvasZYy8q&arr_license=3268617&name=HBEDV.KEY&realname=HBEDV.KEY" style="cursor:pointer;" class="download_product" title="Download key"><img src="/images/icons/download_key.png"/></a>

...I want to download the file HBEDV.KEY from the URL: "/admin/cst/download.php?customer_id=3361368&id=LSvasZYy8q&arr_license=3268617&name=HBEDV.KEY&realname=HBEDV.KEY"

sorry for english and thanks

Link to comment
Share on other sites

@FSoft

#include <String.au3>
$s_String = '<a href="/admin/cst/download.php?customer_id=3361368&id=LSvasZYy8q&arr_license=3268617&name=HBEDV.KEY&realname=HBEDV.KEY" style="cursor:pointer;" class="download_product" title="Download key"><img src="/images/icons/download_key.png"/></a>'

$url = _StringBetween($s_String,'<a href="','" style')
MsgBox(64, '_StringBetween', $url[0])

I dont know if its what you want...

Cheers, FireFox.

Link to comment
Share on other sites

Maybe I don't make myself clear...

I have a web page with images, buttons, texts, etc..

There is an image which points to a file. (See previous post)

To download a file, I should use InetGet.

My question is: Is there a way to get that URL and use InetGet (or another command) to download that file?

I hope I make myself clear! :)

Link to comment
Share on other sites

@FSoft

Try to put more strings into start and end for make it more precise...

Cheers, FireFox.

Where do I try to mut more strings? [sorry, but I don't understand :huh: ]

I can't resolve the problem...

I post the full web page, so you can give me a better help:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon">
  <title>Avira Online Shop</title>
  <link rel="stylesheet" type="text/css" href="/includes/css/front.css">
  <link rel="stylesheet" type="text/css" href="/includes/css/antivir-pe_04.css">
  <link rel="stylesheet" type="text/css" href="/includes/css/cleverDesign.css">
  <script language="javascript" type="text/javascript" src="/includes/js/scripts.js"></script>
  <script language="javascript" type="text/javascript" src="/includes/js/ajax/ajax.js"></script>
</head>
<body id="jsEnvId2">
<table style="margin: 0pt auto; font-size: 10pt;" border="0" cellpadding="0" cellspacing="0" width="1006"><tbody><tr>
<td width="2%"> </td>
<td width="96%"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody>
<tr>
<td rowspan="4" class="leftcolumn"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    <td style="background-color: rgb(255, 255, 255);" align="center" valign="middle"><a href="http://www.avira.com/en/"><img src="/images/logo_web.gif" alt="Avira Home" border="0" height="102" vspace="7" width="102"></a></td>
    <td style="background-color: rgb(255, 255, 255);"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    <td colspan="3" style="background-color: rgb(255, 255, 255); background-image: url(/images/top_picture_en.jpg); background-repeat: no-repeat; background-position: center;"></td>
    <td rowspan="4" class="rightcolumn"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    </tr>
<tr class="middle_bar">
<td align="center"><select name="id_lng" class="select_languages" onchange="window.location=this.options[this.selectedIndex].value;">
  <option value="/de/license.html?id=w3iZnZB0na">Deutsch</option>
  <option value="/en/license.html?id=w3iZnZB0na" selected>English</option>
  <option value="/it/license.html?id=w3iZnZB0na">Italian</option>
</select>
  </select></td>
    <td><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    <td style="padding-left: 5px;"><a href="http://www.avira.com/en/" class="navigator">Home</a> <img src="/images/double_arrow.gif" class="align_middle" alt="navigator" border="0"> 
    <a href="http://www.avira.com/en/products/index.html" class="navigator">Products</a> <img src="/images/double_arrow.gif" class="align_middle" alt="navigator" border="0"> 
            <a href="http://www.avira.com/en/estore/" class="navigator">Online Shop</a> <img src="/images/double_arrow.gif" class="align_middle" alt="navigator" border="0"> License Management</td>
        <td colspan="2" style="padding-right: 10px;" class="white" align="right">
            <img src="/images/double_arrow.gif" class="align_middle" alt="navigator" border="0">&nbsp;<a href="logout.html?id=w3iZnZB0na" class="subcategs">Logout</a>
    <!--form name="frm_search" method="get" action="/de/search/index.html">
        <strong>Suche</strong> <input name="q" maxlength="32" class="search_box" type="text">
        <input src="/mycontent/30/submit_blue.gif" class="align_middle" alt="Search" type="image">
    </form--></td>
    </tr>
<tr>
<td class="left_menu" style="border-top: 1px solid rgb(255, 255, 255); font-size: 12pt;" valign="top">
        <!-- InstanceBeginEditable name="left_menu" --><!-- InstanceEndEditable -->
<table style="margin-top: 10px;" border="0" cellpadding="1" cellspacing="0" width="100%"><tbody>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/" class="categs">Home</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/support/index.html" class="categs">Support</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/solutions/index.html" class="categs">Solutions</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line_hover" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line_hover';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/products/index.html" class="categs">Products</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line_hover" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line_hover';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/download/index.html" class="categs">Download</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/threats/index.html" class="categs">Virus Info</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/company/index.html" class="categs">Company</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/press_releases/index.html" class="categs">Press</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/partner/index.html" class="categs" >Partners</a>
</td>
        </tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
        </tr>
<tr>
<td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
<img src="/images/red_arrow.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="http://www.avira.com/en/newsletter/index.html" class="categs">Newsletter</a></td>
</tr>
<tr>
<td class="menu_line" align="center"><img src="/images/sand.jpg" alt="bar" border="0" height="1" width="145"></td>
</tr>
<!-- Display condition for subnavigation of MyAccount -->
    <tr>
    <td class="menu_line" onmouseover="this.className='menu_line_hover';" onmouseout="this.className='menu_line';">
    <img src="/images/red_arrow_down.gif" alt="arrow" class="align_middle" border="0" height="10" hspace="3" width="10"><a href="#" class="subcategshi">My Account</a></td>
    </tr>
<!-- Display condition for subnavigation of MyAccount -->
    <tr>
    <td class="menu_sub_line" onmouseover="this.className='menu_sub_line_hover';" onmouseout="this.className='menu_sub_line';"><img src="/images/spacer.gif" alt="" class="align_middle" border="0" height="10" hspace="3" width="6">
        <strong>&nbsp;<a href="license.html?id=w3iZnZB0na" class="subcategshi">License Overview</a></strong>
        </td>
    </tr>
    <tr>
    <td class="menu_sub_line" align="center"><img src="/images/menu_sep.gif" alt="" border="0" height="2" width="142"></td>
    </tr>
    <tr>
    <td class="menu_sub_line" onmouseover="this.className='menu_sub_line_hover';" onmouseout="this.className='menu_sub_line';">
      <img src="/images/spacer.gif" alt="" class="align_middle" border="0" height="10" hspace="3" width="6">
        &nbsp;<a href="editcustomer.html?id=w3iZnZB0na" class="subcategs">My Data</a>
    </td>
    </tr>
    <tr>
    <td class="menu_sub_line" align="center"><img src="/images/menu_sep.gif" alt="" border="0" height="2" width="142"></td>
    </tr>
    <tr>
    <td class="menu_sub_line" onmouseover="this.className='menu_sub_line_hover';" onmouseout="this.className='menu_sub_line';">
      <img src="/images/spacer.gif" alt="" class="align_middle" border="0" height="10" hspace="3" width="6">
        &nbsp;<a href="recommendedfriend.html?id=w3iZnZB0na" class="subcategs">Recommend a friend</a>
    </td>
    </tr>
    <tr>
    <td class="menu_sub_line" align="center"><img src="/images/menu_sep.gif" alt="" border="0" height="2" width="142"></td>
    </tr>
    <tr>
    <td class="menu_sub_line" onmouseover="this.className='menu_sub_line_hover';" onmouseout="this.className='menu_sub_line';">
      <img src="/images/spacer.gif" alt="" class="align_middle" border="0" height="10" hspace="3" width="6">
        &nbsp;<a href="editpwd.html?id=w3iZnZB0na" class="subcategs">Change Password</a>
    </td>
    </tr>
    <tr>
    <td class="menu_sub_line" align="center"><img src="/images/menu_sep.gif" alt="" border="0" height="2" width="142"></td>
    </tr>
    <tr>
    <td class="menu_sub_line" onmouseover="this.className='menu_sub_line_hover';" onmouseout="this.className='menu_sub_line';">
      <img src="/images/spacer.gif" alt="" class="align_middle" border="0" height="10" hspace="3" width="6">
        &nbsp;<a href="logout.html?id=w3iZnZB0na" class="subcategs">Logout</a>
    </td>
    </tr>
</tbody></table>
</td>
    <td rowspan="2" style="background-image: url(/images/v_dot.gif); background-repeat: repeat-y;"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    <td style="padding: 10px; background-color: rgb(255, 255, 255);" colspan="2" valign="top">
    <div id="print_area">
    <!-- Content cleverbridge.com -->
    <div id="cleverContent">
<div class="blockHeadline">
    <div id="cleverLicense">
    <h1>License Overview</h1>
    </div>
</div>
<div class="blockContent">
<h2>Download or renew license(s)</h2><br>
<p>Please download your license (HBEDV.KEY) and store it on your PC. You will be prompted to import the license during the installation of your Avira product. If you haven't installed the product already please download it <a href="http://www.avira.com/en/download/index.html">here</a>. The installation requires you to uninstall your existing Avira product first.</p>
<table class="tableLicense_new">
    <tr><td>
    <table class="tableLicense_new">
        <tr>
            <td class="product_new">Product</td>
            <td class="download_new">Download</td>
            <td class="valid_new">Valid until</td>
            <td class="renew_new">Action</td>
        </tr>
                                                                                                                <tr>
                            <th colspan="5" class="resellerName"><span class="resellerName">msmzelwvvo zzqsh</span></th>
                        </tr>
                                                                <form method="POST" name="renew_form_1" id="renew_form_1" action="renewal.html?id=w3iZnZB0na&product=4">
                        <input type="hidden" name="x_rl" value="1103524281" />
                        <input type="hidden" name="x_ident" value="3626900:290d42d80c043ef942c0e9e018317a30:358696513" />
                        <tr valign="center">
                            <td class="productName_new">
                                <img id="recent_details_holder_img_0" name="recent_details_holder_img_0" src="/images/admin/plus.gif" onclick="Customer.ShowProductDetails('recent_details_holder_img_0','recent_details_holder_status_0','recent_details_holder_0');" title="Show details" style="cursor:pointer;" align="absmiddle"/>&nbsp;<a class="product_details" title="Avira AntiVir Premium - 1 Year" onclick="Customer.ShowProductDetails('recent_details_holder_img_0','recent_details_holder_status_0','recent_details_holder_0');">Avira AntiVir Premium - 1 Year</a>&nbsp;&nbsp;&nbsp;                                <input type="hidden" id="recent_details_holder_status_0" name="recent_details_holder_status_0" value="0"/> 
                                <div style="padding:5px; display:none;" id="recent_details_holder_0" name="recent_details_holder_0">
                                    <table class="table_admin" style="border:0px solid #000000">
                                                                                                                        <tr valign="center">
                                            <td class="license_no_new" >
                                                <input type="checkbox" name="licenses_file[]"  id="licenses_file_1" value="3270752" /> License No.: 1103524281                                             </td>
                                        </tr>
                                                                            </table>
                                </div>
                            </td>
                            <td>
                                <table width="100%" height="100%" style="border:0px;">
                                <tr>
                                    <td height="100%" width="50%" align="center">
                                        <a href="http://dlpe.antivir.com/down/windows/antivir_workstation_winu_en_hp.exe" style="cursor:pointer;" class="download_product" title="Download product"><img src="/images/icons/download_product.png"/></a>
                                                                            </td>
                                    <td height="100%" width="50%" align="center">
                                        ===>BUTTON===><a href="/admin/cst/download.php?customer_id=3362789&id=w3iZnZB0na&arr_license=3270752&name=HBEDV.KEY&realname=HBEDV.KEY" style="cursor:pointer;" class="download_product" title="Download key"><img src="/images/icons/download_key.png"/></a><===BUTTON<===
                                    </td>
                                </tr>
                            </table>
                            </td>
                            <td class="default_new">28.02.2009 (<a class="online_shop_no_new" title="Number of days until this license will expire.">31 days</a>)</td>
                            <td class="default_center_new" nowrap>
                                                                                                    <a class="renew_new" href="renewal.html?id=w3iZnZB0na&product=4&x_rl=1103524281&x_ident=3626900:290d42d80c043ef942c0e9e018317a30:358696513" title="Renew"><img src="/images/admin/license_refresh.png"/>&nbsp;Renew</a>
                            </td>
                        </tr>
                                                            </form>
                                                                </table>
        </td></tr>
        <tr valign="center">
            <td>
                <table class="tableLicense_new">
                    <tr valign="center">
                        <td class="send_license_new">
                                                        Send license(s) to:
                                                            <select name="send_license_to" id="send_license_to" class="ntxselect">
                                                                            <option value="gvbkojesu@gvbkojesu.com">gvbkojesu@gvbkojesu.com</option>
                                                                    </select>
                                                        &nbsp;
                            <a style="cursor:pointer;" class="send_license_new" onclick="Customer.SendLicense(3362789,'1','send_license_to','front','You will receive an archive containing the license file(s) in your email inbox.<sep>You will receive the license file in your email inbox.<sep>The archive containing the license files has been successfully sent. Please check your email inbox!<sep>The license file has been successfully sent. Please check your email inbox!<sep>Please select at least one license to be send!<sep>Please select the license(s) to be replaced!','en');" title="Send license(s)"><img src="/images/admin/key_go.png"/>&nbsp;Send</a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
        </div>
    <!-- /Content cleverbridge.com -->
    </div> 
    </td>
    <td rowspan="2" style="background-image: url(/images/v_dot.gif); background-repeat: repeat-y;"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="1"></td>
    </tr>
<tr>
<td width="10%"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="150"></td>
    <td width="75%"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="655"></td>
    <td width="15%"><img src="/images/spacer.gif" alt="spacer" border="0" height="1" width="180"></td>
    </tr>
<!-- Footer -->
    <tr class="bottom_bar">
    <td colspan="7" align="center">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tbody>
    <tr>
    <td align="center" nowrap="nowrap" width="15%">
    &nbsp;&nbsp;&copy;&nbsp;2009&nbsp;Avira GmbH
    </td>
    <td align="center" nowrap="nowrap" width="70%">
    <a href="http://www.avira.com/en/company/copyright.html" class="link_footer">Copyright</a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
    <a href="http://www.avira.com/en/privacy.html" class="link_footer">Privacy
    </a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
    <a href="http://www.avira.com/en/sitemap.html" class="link_footer">Sitemap</a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
    <a href="http://www.avira.com/en/feedback.html" class="link_footer">Feedback</a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
    <a href="http://www.avira.com/en/company/imprint.html" class="link_footer">Imprint</a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
      <a href="http://www.avira.com/en/support/faq.html" class="link_footer">FAQ</a>
      <img src="/images/sand.jpg" alt="" class="align_middle" border="0" height="10" hspace="3" width="2">
    <a href="http://www.avira.com/en/company/contact.html" class="link_footer">Contact</a>
    </td>
    <td align="center" width="15%">
    &nbsp;
    <a href="mailto:hbcom.egal@blackholecomputing.com">
    </a>
    <a href="mailto:marc.paulescu@avira.com">
    </a>
    <a href="mailto:aacom.egal@blackholecomputing.com">
    </a>
    </td>
    </tr>
    </tbody>
    </table>
    <div id="zoomer" style="border: 1px solid black; padding: 5px; position: absolute; display: none; z-index: 2; background-color: rgb(255, 255, 255);">
    </div>
    </td>
    </tr>
    <!-- /Footer -->
</tbody></table></td>
<td width="2%"> </td>
</tr></tbody></table>
<!-- InstanceEnd -->
<div style="position: absolute; left: 0px; top: 0px; visibility: hidden;" class="eventContainerWrapper" id="eventContainercleverEventContainer"><div id="eventContainercleverEventContainerHeader"></div><div class="eventContainerContent" id="eventContainercleverEventContainerContent"></div></div></body></html>

The button I want to click is enclosed between "===>BUTTON===>" and "<===BUTTON<===". I can't find a solution...IE functions are not sufficent.

I need a function like "_IE_GetLinkfromImage", but it doesn't exist :):lmao:

bye

Link to comment
Share on other sites

here try this:

#include <String.au3>
#include <inet.au3>
$s_String = _inetgetsource("you_page_here")

$url = _StringBetween($s_String,'<a href="','" style="cursor:pointer;" class="download_product" title="Download key"><img src="/images/icons/download_key.png"/></a>')
MsgBox(64, '_StringBetween', $url[0])
Thanks, your script works very well...but the problem is that I can't use the "title" of the image becase this script should works also if the title is different.

Is there any way to do this without use the "title" or using only the image URL?

thanks for help

Link to comment
Share on other sites

let me show you example

#include <String.au3>
#include <inet.au3>
$link = _getlinkfromimage("your_url_here", "/images/icons/download_key.png")
MsgBox(64, "Link", $link)
func _getlinkfromimage($page, $img_url)
$s_String = _inetgetsource($page)
$url = _StringBetween($s_String,'<a href=','<img src="'&$img_url&'"/></a>')
$url2 = _StringBetween($url[0], '"', ' "')
return $url2[0]
EndFunc

I make function, not yet test. tell me how it work =]

Edited by syko
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...