Results 1 to 3 of 3
  1. #1
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Exclamation Problem with CraigList Checker

    Hi
    I am trying to build an application that checks whether there has been a new post in a specific craigslist section "Computers for example"
    so I am using the getLastModified() from the HttpUrlConnection Class (the code is shown below), when I test this code on other websites it works just fine, but with craigslist website it keeps telling me there is an update and when I check I find no update, so any idea about why is it behaving like that?

    Java Code:
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.util.Date;
    
    public class Main{
      public static void main(String args[]) throws Exception {
        URL url = new URL("http://orlando.craigslist.org/sya/");
        HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
    
        long date = httpCon.getLastModified();
        if (date == 0)
          System.out.println("No last-modified information.");
        else
          System.out.println("Last-Modified: " + new Date(date));
    
     }
    }
    Thank you and Regards.
    Anderson.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,231
    Blog Entries
    7
    Rep Power
    24

    Default Re: Problem with CraigList Checker

    Can't that date be somewhere in the past? (unequal to zero)

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default Re: Problem with CraigList Checker

    Quote Originally Posted by JosAH View Post
    Can't that date be somewhere in the past? (unequal to zero)

    kind regards,

    Jos
    Thank you for your reply, I should have said my code is included in a while(true) loop which performs the previous command each 5 seconds so it keeps checking.

    Regards.
    Anderson.

Similar Threads

  1. Sudoku checker
    By kennemercollege in forum New To Java
    Replies: 3
    Last Post: 04-27-2011, 12:41 PM
  2. number checker?
    By linc186 in forum New To Java
    Replies: 3
    Last Post: 03-05-2011, 12:12 PM
  3. isbn checker
    By jingliu316 in forum New To Java
    Replies: 2
    Last Post: 10-27-2010, 07:31 PM
  4. Grammar Checker
    By zaz_rin in forum New To Java
    Replies: 1
    Last Post: 07-19-2009, 02:01 PM
  5. ISBN Checker
    By blobs86 in forum New To Java
    Replies: 1
    Last Post: 03-24-2009, 12:07 AM

Posting Permissions

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