Reputation: 239
I'm porting a bash script in obj-c. Currently in the bash script I do 'curl http://... > file.txt' to download and save the webpage source code.
I played around with NSUrl, but I didn't get it to work. Any ideas ?
Upvotes: 0
Views: 226
Reputation: 44633
Are you looking for something like this –
NSData *data = [NSData dataWithContentsOfURL:yourURL];
[data writeToFile:filePath atomically:YES];
Note that this is a synchronous method so it will block until data is downloaded.
Upvotes: 1
Reputation: 1171
If you are asking how to use NSUrl, just use the initWithString: method and put in your url with the @"string" format.
Upvotes: 0