[NSString stringWithContentsOfURL:] not working
[NSString stringWithContentsOfURL:] not working
- Subject: [NSString stringWithContentsOfURL:] not working
- From: Oliver Donald <email@hidden>
- Date: Tue, 14 Sep 2004 10:49:07 +0100
Title: [NSString stringWithContentsOfURL:] not working
Hi list,
Part of a current small project parses stories posted on Slashdot for comments that meet certain requirements, and then creates a digest of these comments that can be emailed/SMS'd/whatever'd to the user.
To begin with, I'm downloading the source page into an NSString with the [NSString stringWithContentsOfURL:] method, but this does not work. If I request a URL like http://www.slashdot.org, it works fine, but requesting a link to an actual story, such as...
http://linux.slashdot.org/comments.pl?sid=121709&threshold=-1&mode=nested&commentsort=0&op=Change
returns an odd string. The code is...
- (BOOL)extract
{
NSURL *storyURL;
NSString *story;
storyUrl = [NSURL URLWithString:[urlField stringValue]];
NSLog("URL = "">
story = [NSString stringWithContentsOfURL:storyURL];
NSLog("HTML = [%@]");
...
...
}
The NSLog'ing of the URL prints exactly what I would expect. However, the NSLog'ing of the HTML prints something like this:
HTML = [*
Where * is a single unicode character, and doesnt print the closing bracket. I looked in the documentation, and couldn't see anything that might give an error, and both NSURL and NSString methods are returning non-nil objects, which would suggest they think everything is ok.
Could anyone tell me what I might be doing wrong here, or what I could do to fix it?
Cheers,
Oli
DISCLAIMER: The information contained in this e-mail is confidential and may be privileged. It is intended for the addressee only. If you are not the intended recipient, please delete this e-mail immediately. The contents of this email must not be disclosed or copied without the sender's consent. We cannot accept any responsibility for viruses, so please scan all attachments. The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the company. The company does not take any responsibility for the views of the author.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden