 |
 |
Http help in Cocoa
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status:
Offline
|
|
Hello!
I was trying to make a little cocoa program that downloads a html-file from a server like http://www.name.com. I made such a program for Mac OS but then I used an example from Apple "OTSimpleDownloadHTTP.c". I haven't found any easy ways of writing it in cocoa. Have someone any suggestions?
/fredrik
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status:
Offline
|
|
I am not sure (I have't tried to do this myself) but you can probably create an instance of NSURLHandle and get it to do exactly that. I don't know from experience, though, just documentation.
Try it
Jeff.
[This message has been edited by Apocalypse (edited 04-27-2001).]
[This message has been edited by Apocalypse (edited 04-27-2001).]
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status:
Offline
|
|
Thank you!
Haven't got it working yet but I still trying. I only got "NSURLHandleNotLoaded" and havn't figure out why.
/fredrik
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
I don't think you can transfer data using any of Apple's frameworks. Omni has graciously provided their frameworks, OmniNetworking and so on, as freeware, opensource and with a license to use and modify in whatever way you please, just about. You might like to also check out OWF, it's probably suited to what you want.
Check out their community section at http://www.omnigroup.com
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Feb 2001
Location: Portland, OR, USA
Status:
Offline
|
|
Originally posted by Angus_D:
I don't think you can transfer data using any of Apple's frameworks.
Actually, NSURL and NSURLHandle can both download via HTTP. If you are doing something simple it is probably easier to use these than to use our frameworks. It you want more control or multi-threaded downloads or HTTP 1.1 pipelined requests or other protocols or whatever, then would be the time you would probably want to look at OWF.
Simple code like:
aURL = [NSURL URLWithString:@"http://www.apple.com"];
data = [aURL resourceDataUsingCache:NO];
Should get the contents of Apple's home page in the NSData object data.
-Greg
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status:
Offline
|
|
Thanks! It worked perfectly, just what I was looking for and a easy way too.
/fredrik
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status:
Offline
|
|
Now when I got the download thing working (I'm not familiar with HTTP commands but I think that was some kind of GET command) I want to do a POST command. I have ADSL internet connection an have to log in on a web page and if I'm idle for an hour it disconnects me so now I'm trying to make a program which can login and keep the connection alive. I need to send username and password. Is there someone who knows how to do it or where I can find information about it, Apple is a bit short in the descriptions. (Information forthcoming...)
/fredrik
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status:
Offline
|
|
That is incredibly cool that Omni has done that. A great company. I can't wait for their next version of their browser that will hopefully fix a few of the complaints I have with it.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|