I am trying to figure out how to strip a HTML scalar (its contents is below) so that i just get the URL.
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="picboost, Images, Free, Upload" />
<meta name="description" content="picboost - the simplest way to host your images" />
<meta name="rating" content="general" />
<meta name="author" content="Henry Legge" />
<meta name="copyright" content="Copyright 2008 PicBoost.com" />
<meta http-equiv="Content-Language" content="en-GB" />
<base href="http://picboost.com/" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="imgs/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="imgs/favicon.ico" type="image/x-icon" />
<title>Picboost - The simplest way to host your images</title>
<script src="http://mint.picboost.com/?js" type="text/javascript"></script>
<script src="/mint/?js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<h1><span>picboost</span></h1>
<div class="box">
<div class="box-top"></div>
<div class="box-main">
<div id="step2">
<h2 id="s2"><span>Distribute Your File</span></h2>
<span>Upload complete!</span>
<p>
<input type="text" name="direct" value="http://picboost.com/images/2008/May/13/wallpaper.gif" maxlength="" size="" id="direct" onclick="this.select()" />
<label for="direct">direct link</label> </p>
<p>
<input type="text" name="bbcode" value="
http://picboost.com/images/2008/May/13/wallpaper.gif" maxlength="" size="" id="bbcode" onclick="this.select()" />
<label for="bbcode">bbcode</label> </p>
<p>
<input type="text" name="html" value="<a href="
http://picboost.com/"><img src="
http://picboost.com/images/2008/May/...aper.gif" alt="PicBoost Image" /></a>" maxlength="" size="" id="html" onclick="this.select()" />
<label for="html">html</label> </p>
<br /><a href="/">Upload another?</a>
</div>
</div>
</div>
<div id="footer">
<div id="credit">
Copyright 2008 PicBoost.com<br />
Created by <a href="http://henrylegge.com">Henry Legge</a><br />
Designed by <a href="http://pixelspread.com">Pixelspread</a><br />
<a href="tos">Terms of Service</a>
</div>
<div id="ad">
<img src="/ad.png" alt="Ad" />
</div>
</div>
</div>
</body>
</html>[/HTML]
I want to strip everything away apart from this chunk: (please note that the URL will change every time the script is run...)
Code:
<input type="text" name="direct" value="http://picboost.com/images/2008/May/13/wallpaper.gif" maxlength="" size="" id="direct" onclick="this.select()" />
then I want to get rid of everything apart from:
Code:
http://picboost.com/images/2008/May/13/wallpaper.gif
this is the code I have so far:
Code:
$response = $response->content;
if ( $response =~ m/<span>Upload complete\!<\/span>/ ){
$conn->privmsg($conn->{channel}, "Upload complete! link at:");
$URL = $response;
$URL =~ s/^((.)*)(\<input type=\"text\" name=\"direct\" value=\")//ig;
$URL =~ s/"(.+)//ig;
print $URL;
}
when I run that code I get:
Code:
<!DOCTYPE html PUBLIC
<html xmlns=
<head>
<meta http-equiv=
<meta name=
<meta name=
<meta name=
<meta name=
<meta name=
<meta http-equiv=
<base href=
<link href=
<link rel=
<link rel=
<title>Picboost - The simplest way to host your images</title>
<script src=
<script src=
<body>
<div id=
<h1><span>picboost</span></h1>
<div class=
<div class=
<div class=
<div id=
<h2 id=
<span>Upload complete!</span>
<p>
<input type=
<label for=
<p>
<input type=
<label for=
<p>
<input type=
<label for=
<br /><a href=
</div>
</div>
</div>
<div id=
<div id=
Copyright 2008 PicBoost.com<br />
Created by <a href=
Designed by <a href=
<a href=
</div>
<div id=
<img src=
</div>
</div>
</div>
</body>
I think I am pretty close to what I intend to do, I just need a little push in the right direction. I have been using this tool:
http://regex.larsolavtorvik.com/ to check my regex, and it seems to work on there.
thanks in advance,
s0l1dsnak3123