Code Help...
Results 1 to 6 of 6

Thread: Code Help...

  1. #1
    Junior Member
    Join Date
    Jul 2001
    Posts
    3

    Code Help...

    A small program that would execute a given URL then add a sequential number to the URL then execute it again.

    Example: http://wwww.example.com/cgi-bin/search.cgi?=file&1

    Example: http://wwww.example.com/cgi-bin/search.cgi?=file&2

    Example: http://wwww.example.com/cgi-bin/search.cgi?=file&3

    And so on, 4, 5, 6, 7....

    Thanks.
    Share on Google+

  2. #2
    Junior Member
    Join Date
    Nov 2001
    Posts
    22
    For what language???
    .......................
    Share on Google+

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Posts
    3
    VB
    Share on Google+

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    101
    It would be easier in java and would still run on your machine...
    - Stronzo

    \"Vini, Vici, Vidi\"
    I came, I saw, I conquered.
    - Julius Caesar
    Share on Google+

  5. #5
    Senior Member
    Join Date
    Oct 2001
    Posts
    101
    In Java it would look something like this (there's most like errors in this but it would be something like as follows):
    Code:
    import java.net.*;
    import javax.swing.*;
    
    public class DoURLS{
    
      public static void main( String args[] )
      {
        string f, s, e;
        int s, e;
    
        f = JOptionPane.showInputDialog( "Enter the URL:" );
        s = JOptionPane.showInputDialog( "Start at:" );
        e = JOptionPane.showInputDialog( "End at:" );
      
        try{
          s = Integer.ParseInt( s );
          e = Integer.ParseInt( e );
          openURL( f, s, e );
        }catch (Exception e){}
      }
    
      public static void openURL( String file, int start, int end ) throws IOException {
        for( int i = start; i < end; i++ )
        {
          URL theURL = new URL( file + i );
          URLConnection theConnection = openConnection();
        }
      }// end openURL
    }
    I haven't tried this code out but In ASP I would do it as follows (I got some of this code from asp101.com):
    Code:
    <% @LANGUAGE = "VBScript" %>
    <% 
    Option Explicit
    On Error Resume Next
    
    Dim Inet1, strHTML, intS, intE, I
    
    If Request( "submit" ) <> Empty &&
        Request( "file" ) <> Empty &&
        Request( "start" ) <> Empty &&
        Request( "end" ) <> Empty Then
    
      set Inet1 = CreateObject("InetCtls.Inet")
      strFile = Request( "file" )
      intS = CInt(Request( "start" ))
      intE = CInt(Request( "end" ))
    
      Inet1.protocol = 4
      Inet1.accesstype = 1
      Inet1.requesttimeout = 60 
    
      for I = intS to intE
        Inet1.URL = strFile & I
        strHTML = Inet1.OpenURL
      next 'I
    
      Set Inet1 = Nothing
    End If
    %>
    <html>
    <body>
      <form method = "POST" action = "thisURL.asp">
        <table>
          <tr>
            <td>Enter the url and file name:</td>
            <td><input type="text" size="40" name="file"></td>
          </tr>
          <tr>
            <td>Enter the start number:</td>
            <td><input type="text" size="40" name="start"></td>
          </tr>
          <tr>
            <td>Enter the end number:</td>
            <td><input type="text" size="40" name="end"></td>
          </tr>
        </table>
      </form>
    </body>
    </html>
    In JavaScript something like this:
    Code:
    var win = null;
    var url = "http://wwww.example.com/cgi-bin/search.cgi?=file" 
    var w = 10;
    var h = 10;
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings =
      'height='+h
      +',width='+w
      +',top='+TopPosition
      +',left='+LeftPosition
      +',scrollbars='+scroll
      +',resizable';
    
    for( i = 0; i < 10; i++ )
    {
      win = window.open(url+i,title,settings);
    }
    Ok, i haven't tested ANY of this code, so it's probably filled with bugs. Sorry! Hopefully something in this will be able to help you out.
    - Stronzo

    \"Vini, Vici, Vidi\"
    I came, I saw, I conquered.
    - Julius Caesar
    Share on Google+

  6. #6
    Junior Member
    Join Date
    Jul 2001
    Posts
    3
    Thanks for the help, I cant kink that code out though.

    I'll keep looking though examples until I find somthing similar.

    C++ would be helpful too.
    Share on Google+

Posting Permissions

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