Imports System.Net
Imports System.IO
Imports System.Text
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objWebRequest As WebRequest = WebRequest.Create(objURI)
Dim objWebResponse As WebResponse = objWebRequest.GetResponse()
Dim objStream As Stream = objWebResponse.GetResponseStream()
Dim objStreamReader As StreamReader = New StreamReader(objStream)
Dim strHTML As String = objStreamReader.ReadToEnd
If strHTML.StartsWith("<div> <img src=") Then
Dim lastLocation As String
strHTML = strHTML.Substring(strHTML.IndexOf("http://www.onemotoring.com.sg/trafficsmart/images/",35))
Image1.ImageURL = strHTML
objStreamReader.Close()
Else
Response.Write("Unsuccessful")
End If
End Sub
End Class
---------------------------------------------------------END-----------------------------------------------------------------------------------
i want to grab the image's url from the source :
http://202.172.177.75/trafficsmart/images/6708.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<meta http-equiv="progma" content="no-cache"/>
<meta http-equiv="expires" content="-1" />
<meta http-equiv="cache-control" content="no-cache">
<TITLE>One Motoring - Camera Image - 6708</TITLE>
<script language="javascript">
var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;} var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-greendot.hitbox.com";
//BEGIN EDITABLE SECTION
//CONFIGURATION VARIABLES
hbx.acct="DM5506245DAS";//ACCOUNT NUMBER(S) - DM5506245DAS
hbx.pn="";//PAGE NAME(S)
hbx.mlc="/Home/Traffic/Camera";//MULTI-LEVEL CONTENT CATEGORY
hbx.pndef="title";//DEFAULT PAGE NAME
hbx.ctdef="full";//DEFAULT CONTENT CATEGORY
//OPTIONAL PAGE VARIABLES
//ACTION SETTINGS
hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME
hbx.lt="auto";//LINK TRACKING
hbx.dlf="n";//DOWNLOAD FILTER
hbx.dft="n";//DOWNLOAD FILE NAMING
hbx.elf="n";//EXIT LINK FILTER
//SEGMENTS AND FUNNELS
hbx.seg="1";//VISITOR SEGMENTATION
hbx.fnl="";//FUNNELS
//CAMPAIGNS
hbx.cmp="";//CAMPAIGN ID
hbx.cmpn="";//CAMPAIGN ID IN QUERY
hbx.dcmp="";//DYNAMIC CAMPAIGN ID
hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY
hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION
hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION
hbx.hra="";//RESPONSE ATTRIBUTE
hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY
hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY
hbx.hlt="";//LEAD TRACKING
hbx.hla="";//LEAD ATTRIBUTE
hbx.gp="";//CAMPAIGN GOAL
hbx.gpn="";//CAMPAIGN GOAL IN QUERY
hbx.hcn="";//CONVERSION ATTRIBUTE
hbx.hcv="";//CONVERSION VALUE
hbx.cp="null";//LEGACY CAMPAIGN
hbx.cpd="";//CAMPAIGN DOMAIN
//CUSTOM VARIABLES
hbx.ci="";//CUSTOMER ID
hbx.hc1="";//CUSTOM 1
hbx.hc2="";//CUSTOM 2
hbx.hc3="";//CUSTOM 3
hbx.hc4="";//CUSTOM 4
hbx.hrf="";//CUSTOM REFERRER
hbx.pec="";//ERROR CODES
//INSERT CUSTOM EVENTS
//var ev1 = new _hbEvent("search");
//END EDITABLE SECTION
//REQUIRED SECTION. CHANGE "YOURSERVER" TO VALID LOCATION ON YOUR WEB SERVER (HTTPS IF FROM SECURE SERVER)
</script>
<script language="javascript1.1" defer src="http://www.onemotoring.com.sg/publish/scripts/hbx.
js"></script>
<link rel="stylesheet" href="http://www.onemotoring.com.sg/publish/styles/om_masthead.css" type="text/css"/>
<link rel="stylesheet" href="http://www.onemotoring.com.sg/publish/styles/om_style.css" type="text/css"/>
</HEAD>
<BODY>
<div id="popup_content">
<div id="subpage_content">
<div align="center">
<h3> View from Jurong West ST81 (Towards Jurong) </h3>
<p>Time: 08/06/2006 20:58 hrs</p>
<div> <img src="http://www.onemotoring.com.sg/trafficsmart/images/6708_2058_20060608205713_aa6397.jpg" border="0"></div>
<h5>Image from Intelligent Transport Systems Center, LTA</h5>
</div>
</div>
</div>
</BODY>
</HTML>
-------------------------------------------------------------------------------end---------------------------------------------------------------------------------------------------------
i need to read the line to the end.. and when it start with '<img src=' i will grab the image's URL (strHTML =http://www.onemotoring.com.sg/trafficsmart/images/6708_2058_20060608205713_aa6397.jpg), because the address keep on changing so i need to grab that line in order to view the image ..
but how? the above is my code but it since like cannot work...
Hope you can help me.
Cathleen