Grab from other sites

Results 1 to 2 of 2

Thread: Grab from other sites

  1. #1
    Join Date
    Dec 1969

    Default Grab from other sites

    Hi again..<BR><BR>Sill having some problems with grabbing news from other sites..<BR>The code i&#039;m using works, but I can only grab the first news displayed on the external site!!<BR><BR>This is where the problem is:<BR><BR>&#060;% sHTML = inet.OpenURL<BR> first = InStr( sHTML, "&#060;!-- news start --&#062;" )<BR> last = InStr( first, sHTML, "&#060;!-- news end --&#062;" )<BR> sFilmmagasinet = Mid( sHTML, first, last-first )%&#062;<BR><BR>Now what i want is to ignore the first found "&#060;!-- news start --&#062;" and to on to the second... or the third for that matter...<BR><BR>This way I can choose with news I want to display on my site!!<BR><BR>Can you help me? (asked before but I can&#039;t find my question anymore)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Grab from other sites

    What you want is a function which finds the next news item, given a start position. You could then write a function which returns the nth news item, given n.<BR><BR>Something like this:<BR><BR>Function ReturnNextNewsItem(intStartPos, strHTML)<BR> <BR> Dim intFirstChar, intLastChar<BR> intFirstChar = InStr(intStartPos, strHTML, "&#060;!-- news start --&#062;")<BR> intLastChar = InStr(intFirstChar, strHTML, "&#060;!-- news end --&#062;")<BR> if intLastChar &#062; 0 then<BR> ReturnNewsItem = Mid(strHTML, intFirstPos, intLastPos-intFirstPos)<BR> else<BR> ReturnNextNewsItem = False<BR> end if<BR> <BR>End Function<BR><BR>Function ReturnNewsItem(intN, strHTML)<BR> <BR> Dim intFirstChar, intLastChar, intCounter<BR> intFirstChar = 0<BR> intLastChar = 1<BR> intCounter = 0<BR> <BR> do until intCounter = intN OR intFirstChar = intLastChar<BR> intFirstChar = InStr(intFirstChar, strHTML, "&#060;!-- news start --&#062;")<BR> intLastChar = InStr(intFirstChar, strHTML, "&#060;!-- news end --&#062;")<BR> if intFirstChar &#060;&#062; 0 then<BR> intCounter = intCounter + 1<BR> else<BR> intFirstChar = 0<BR> intLastChar = 0<BR> end if<BR> loop<BR> <BR> Dim strNewsItem<BR> <BR> if intCounter = intN then<BR> strNewsItem = ReturnNextNewsItem(intFirstPos, strHTML)<BR> else<BR> strNewsItem = "Not Found"<BR> end if<BR> <BR>End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts