473,749 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change a url to hyperlink?

3 New Member
Hi,

Thanks for reading this. I have searched all over the web but found no solution. How would one change a url to a hyperlink and email the hyperlink...I parsed through an html file to get this

Expand|Select|Wrap|Line Numbers
  1. </table><br><div><a class="red_link" href="http://dabcd123456:80/results/report.jsp?a=HGUYU&amp;b=HGUYU&amp;c=%2Fc%2B%2Btest%2F&amp;id=%3Ademd140149%3A1193283688721.html%2BDefault%2Bsmith%3A">TCM report &gt;&gt;&gt;</a></div><br><table width="95%" border="1" bordercolor="#999999" cellpadding="0" cellspacing="0">
  2.  
and I parse and got the url out:
"http://dabcd123456:80/results/report.jsp?a=HG UYU&amp;b=HGUYU &amp;c=%2Fc%2B% 2Btest%2F&amp;i d=%3Ademd140149 %3A119328368872 1.html%2BDefaul t%2Bsmith%3A">

How can I change the url into a hyperlink and send that link in an email to someone?

Thanks,
Monkey
Oct 25 '07 #1
6 5434
numberwhun
3,509 Recognized Expert Moderator Specialist
What have you tried thus far? Can you please share your code with us?

Regards,

Jeff
Oct 25 '07 #2
monkey2007
3 New Member
Hi,

I tried a bunch of stuff, but they don't work, so I deleted them already..this is the last thing I tried ##my $content = get $url; that doesn't work either. I also tried the string replacement, but that's too cumbersome and if the url changes it would be no good! $text =~ s[($RE{URI}{HTTP} )] doesn't work
This is what I have so far that works in extracting the URL

Expand|Select|Wrap|Line Numbers
  1.  my($File) = @_;
  2.   open(STDIN, $File) || die("Could not open file!");
  3.   while(<STDIN>){
  4.      my($data)=$_;
  5.      ##print "$data \n";
  6.      if ($data =~ m/(http.*).+report/i ){
  7.         ##print "$1 \n"
  8.      }   
  9.  }
  10. close(STDIN);
  11.  
Please help!

Thanks,
Monkey
Oct 25 '07 #3
numberwhun
3,509 Recognized Expert Moderator Specialist
Monkey,

In your original post and in the last post, I had to place the necessary code tags in your post. Please be sure, per the document in the link, to add them to all future code posting.

Regards,

Moderator
Oct 25 '07 #4
eWish
971 Recognized Expert Contributor
Would you please post some sample data from the file you are using? If you are getting a match into $1 and it contains only the url then you can do something like this.
Expand|Select|Wrap|Line Numbers
  1. my($File) = @_;
  2.   open(STDIN, $File) || die("Could not open file!");
  3.        while(my $data = <STDIN>){
  4.             if ($data =~ m/(http.*).+report/i ){
  5.                 my $link  = qq{<a href="$1">Click Me</a>};
  6.                   &send_email($link);  #Send $link as an arugement to a sub that will then include the $link in the body of the message.
  7.              }   
  8.          }
  9. close(STDIN);
  10.  
  11. sub send_email {
  12.  
  13.     my ($email_link) = @_;
  14.  
  15.     my $message_type = 'text/html';
  16.     my $from_email = 'From@someemail.com';
  17.     my $to_email = 'To@someemail.com';
  18.     my $subject = 'Requested Link';    
  19.     my $message = qq{Hello here is your link $email_link};
  20.  
  21.     #You can use any email module you wish.  Example given with Mime::Lite;
  22.     use Mime::Lite;
  23.  
  24.     my $msg = MIME::Lite->new(
  25.         From    => $from_email,
  26.         To        => $to_email,                
  27.         Subject => $subject,
  28.         Type    => $message_type,
  29.         Data    => $message
  30.     );
  31.  
  32.     $msg->send() || die "Couldn't send message:";
  33. }
Oct 26 '07 #5
monkey2007
3 New Member
Hi eWish,

Thank you for your response, this is what I need. Thanks so much. You save me hours =)

Monkey
Oct 29 '07 #6
eWish
971 Recognized Expert Contributor
Glad to hear it helped. :)
Oct 30 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
8933
by: Gareth Clayton | last post by:
I have imported a title list from excel to an access database table and would like to know how to change the imported URL which is long and ugly into html hyperlink code with the title name as the actual hyperlink. eg <a href=URL><u>TITLE</u></a> The title and url are different for each record. At the end of it all I want to be able to import the database record (hyperlink) using the database results component in frontpage to create a...
1
2552
by: Robbo | last post by:
Hello, I created a datagrid with a few hyperlink columns.. How do i change the color of the hyperlink itself? BLUE is a bit bad on my datagrid color scheme. Thanks, Rob
0
550
by: Ryan Harvey | last post by:
Hi all, I have written a web user control that contains a repeater control. the ItemTemplate for this control is basically 6 Hyperlinks in a row, that are dynamically allocated one of 7 gif images as the ImageURL of the Hyperlink. When a load the page with the controls on it works fine, but sometimes the images are broken, but if i hit refresh i get random selections of the gifs appearing and not appearing. if i hit Back button to a page...
2
2024
by: Imran Aziz | last post by:
Hello All, I want to change the size of my hyper lnks in a repeater control dynamially using the onItemBound event, as under, but cannot seem to understand how to alter the properties to do that. <asp:HiddenField ID="maxFrequency" runat="server" />
6
2094
by: eswanson | last post by:
In jscript, I would like to be able to set the href attribute of the anchor element. I have a aspnet:hyperlink button on the page, but I would like to be able to set the href attribute of this element via jscript. How do I do this? I am attempting to prevent extra trips to the server. Currently, I set the navigateurl in server side scripting, but I know the answer on the client. Thanks
1
1635
by: Vear | last post by:
I have a gridview inside a content placeholder that has the first column as a hyperlink. I changed it from a Hyperlinkfield to a Template field so I could name the hyperlink control. I can't figure out how to reference it so I can change the URL depending on which Stored procedure I bind to it during form load. Is there a way to change it URL via VB. This is in a content form within a master page if that makes any difference. Thank...
3
1659
by: jarrett.roberts | last post by:
I am relatively new with C# and ASP.NET. I created an application using WinForms in which I have several hyperlinks. I want their position on the webpage to be determined (dynamically) based on the state of the user. I have been checking online, but I can't find anywhere that explains how I can change the position (coordinates) of my HyperLink object in a way similar to below: Hyperlink h; h.X = 124;
0
2159
by: =?Utf-8?B?Um9nZXI=?= | last post by:
In my app I would like to change the color of the hyperlink from blue to purple when a user clicks the hyperlink in a RichTextBox. The DetectUrls property is set to True and I handle the RichTextBox1.LinkClicked event to launch a browser window. That works fine. The problem is that once the DetectUrls property is True the RichTextBox control shows the link in blue even if I select the text and change the SelectionColor to purple. For...
1
2223
by: simonyong | last post by:
Hi, I have a hyperlinkbutton in my datagrid Initially, I set the text of the hyperlink button as "show" once user click it, i want it to change into "view more detail" I tried to change as below but it lose its hyperlink function and just as a text only
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.