Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Http help in Cocoa

Http help in Cocoa
Thread Tools
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status: Offline
Reply With Quote
Apr 27, 2001, 08:08 AM
 
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
Reply With Quote
Apr 27, 2001, 08:12 AM
 
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).]
Spectral Class
"Shedding Light on Innovation"
     
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Göteborg, Sweden
Status: Offline
Reply With Quote
Apr 27, 2001, 10:45 AM
 
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
Reply With Quote
Apr 27, 2001, 12:18 PM
 
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
Reply With Quote
Apr 27, 2001, 12:32 PM
 
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
Reply With Quote
Apr 27, 2001, 01:16 PM
 
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
Reply With Quote
Apr 27, 2001, 02:52 PM
 
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
Reply With Quote
Apr 27, 2001, 02:54 PM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:28 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2