Just for fun...
Here is some java to just request the Http Status code (200 ok , 404
etc.)from a URL , it *should* be much faster than using cfhttp ... wrap it
up in a java cfx , and there you go.
Good exercise for you :-)

If you need help give me a shout and I'll get to it a some stage :-)

Justin

To run the class as is , if you have the JDK installed just run

javac Main.java

and then

java Main

>From the cmd line

http://www.allaire.com is hardcorded in ...


//------------------ java code ---------------------
import java.net.*;
import java.io.*;

class Main {
    public static void main (String[] args)
{
        int responseCode;
        HttpURLConnection connection;


        try
        {
        URL url = new URL("http://www.allaire.com");
        connection = (HttpURLConnection)url.openConnection();
        responseCode = connection.getResponseCode();
        System.out.println("Status: " + responseCode );


        }
                 catch (MalformedURLException e)
                 {
                    e.printStackTrace();

                }
                 catch (IOException e) {
                           e.printStackTrace();
                }

        }
}

> -----Original Message-----
> From: Craig Bowes [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 13, 2000 4:23 PM
> To: CF-Talk
> Subject: Re: cfhttp
>
>
>
> Peter,
>
> You do this by using cfhttp as follows:
>
> <cfhttp url="directory/myurl.cfm" method="POST" resolveurl="false">
> </cfhttp>
>
> <cfif cfhttp.filecontent does not contain "error" and cfhttp.filecontent
> does not contain "connection">
>  <a href="directory/myurl.cfm">some link here</a>
> </cfif>
>
> The only problem is, for every link that needs to be checked, cfhttp will
> take a while to check the page and thus slow down YOUR page that has the
> links.  CFHTTP is kind of slow.  A better way to do this would be to
> database all your links, then create a scheduled task that checks all the
> links at once, maybe once a day or month or so,  and and alters
> the database
> as to whether or not each one has an error or connection failure.
>  Then you
> run a query against this database checking the status of each
> link the last
> time it was checked and displaying it or not based on what it finds in the
> database.  If your links are already stored in a database, this
> will be easy
> because you'll just have to add another bit field and call it
> "validlink" or
> something.
>
> -Craig Bowes
> Coldfusion Programmer
> [EMAIL PROTECTED]
> 972.243.1171
>
> ----- Original Message -----
> From: "Peter Benoit" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, November 13, 2000 9:52 AM
> Subject: cfhttp
>
>
> > How can I use cfhttp if the page doesn't exist?
> >
> > I have a list of links, in case one doesn't exist anymore, I'd
> like to not
> > present it.  Is cfhttp the best way to do this?
> >
> > Thanks,
> > Pete
> >
> >
> --------------------------------------------------------------------------
> ----------------------
> > Archives: http://www.mail-archive.com/[email protected]/
> > Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a message with 'unsubscribe' in the body to
[EMAIL PROTECTED]
>

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]


------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to