If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > reciprocal links exchange maintenance script (search other Links Pages for my(or logi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-21-09, 05:43
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
reciprocal links exchange maintenance script (search other Links Pages for my(or logi

I am going to do a web-based "reciprocal links exchange maintenance script" (search other Links Pages for my(or login person) links correspondingly to assure links exist) with login/db well:
how given a URL I search for words/URLs in it's contents(source) in JAVA and JSP?
What language choose to implement this [tell me prefered 3 languages(web-based) for this] ?
search contents SOURCE CODE and contents WHAT APPEAR ONLINE(Presentation) separatelly , or NON- only source ?
Reply With Quote
  #2 (permalink)  
Old 12-21-09, 06:06
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
I've done this in PHP and it wasn't too difficult. Just grab the source of the web page and split it into separate links alongwith the text part of the link. Repeat for each url on your main page. If the page doesn't contain any good data then mark it as dead. If the page contains a link back to your page then mark it as a reciprocated etc. List out all the URLs and their status at the end.
Reply With Quote
  #3 (permalink)  
Old 12-21-09, 14:11
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
How I grab the source of the web page (url) in a text var ?
what if not html/htm but php/jsp/cfm...?
Reply With Quote
  #4 (permalink)  
Old 12-21-09, 15:03
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by lse123
How I grab the source of the web page (url) in a text var ?
The following grabs the source for a web page and splits it into urls and the text that goes with it. It's not perfect but I'm sure you can improve things if you want.
Code:
<?php

$start_url = "http://www.bikesandkites.com/";

# get the file contents
$str = @file_get_contents( $start_url );

# split it into parts where each contains a url
$links = spliti( "<a ",$str );

# for each part
for( $i=0;$i<count($links);$i++ ) {
        # grab and clean up url
        $url = ereg_replace( "\>.*", "", $links[$i] );
        $url = eregi_replace( ".*href=", "", $url );
        $url = eregi_replace( "http:..", "", $url );
        $url = eregi_replace( " .*", "", $url );

        # grab and clean up txt part of link
        $txt = ereg_replace( "^[^>]*>", "", $links[$i] );
        $txt = ereg_replace( "[<].*", "", $txt );

        # print url and text
        echo "url=$url txt=$txt\n";
};

?>
Quote:
Originally Posted by lse123
what if not html/htm but php/jsp/cfm...?
Why should that matter?
Reply With Quote
  #5 (permalink)  
Old 12-21-09, 16:47
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
what if not html/htm but php/jsp/cfm...? server code like <?=...?> will not appear correct ? what will appear after grab ?
Reply With Quote
  #6 (permalink)  
Old 12-21-09, 16:57
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by lse123 View Post
what if not html/htm but php/jsp/cfm...? server code like <?=...?> will not appear correct ? what will appear after grab ?
Why don't you try it and find out? if it's not correct then you could always try writing a little code yourself...
Reply With Quote
  #7 (permalink)  
Old 12-24-09, 03:55
macpeter macpeter is offline
Registered User
 
Join Date: Dec 2009
Posts: 1
java

you have to make reciprocal link in your language which suites you better it can be java or c++
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On