Uses libcurl to GET and POST NSData from URLs.
It uses the easy interface of libcurl. The curl library is compiled
for HTTP(S) only.
Written in and for mulle-objc.
On linux ensure, that openssl is available:
sudo apt-get install libssl-dev(debian/ubuntu)
| Release Version | Release Notes | AI Documentation |
|---|---|---|
| RELEASENOTES | DeepWiki for MulleCurl |
This example fetches a text file and prints it out.
#import <MulleCurl/MulleCurl.h>
#include <stdio.h>
static NSString *URL = @"https://www.mulle-kybernetik.com/weblog/2019/mulle_objc_0_16_release.html";
int main( void)
{
MulleCurl *curl;
NSData *data;
NSError *error;
curl = [[MulleCurl new] autorelease];
[curl setOptions:@{
@"CURLOPT_SSL_VERIFYPEER": @(NO),
@"CURLOPT_SSL_VERIFYHOST": @(NO)
}];
data = [curl dataWithContentsOfURLWithString:URL];
if( ! data)
{
error = [NSError mulleExtractError];
fprintf( stderr, "%s\n", [[error description] UTF8String]);
return( 1);
}
printf( "%.*s", (int) [data length], [data bytes]);
return( 0);
}Notable is the simple interface. Instead of -dataWithContentsOfURL:error: it
is just -dataWithContentsOfURLWithString:. You don't have to wrap the string
into an NSURL and the NSError can be retrieved later if desired.
MulleWeb adds a NSURL interface for
convenience.
Use mulle-sde to add MulleCurl to your project:
mulle-sde add github:MulleWeb/MulleCurlUse mulle-sde to build and install MulleCurl and all dependencies:
mulle-sde install --prefix /usr/local \
https://github.com//MulleCurl/archive/latest.tar.gzInstall the requirements:
| Requirements | Description |
|---|---|
| openssl | |
| curl | |
| MulleFoundationBase | 🧱 MulleFoundationBase amalgamates Foundations projects |
| MulleZlib | 🐘 Zlib compression for mulle-objc |
| mulle-objc-list | 📒 Lists mulle-objc runtime information contained in executables. |
Download the latest tar or zip archive and unpack it.
Install MulleCurl into /usr/local with cmake:
PREFIX_DIR="/usr/local"
cmake -B build \
-DMULLE_SDK_PATH="${PREFIX_DIR}" \
-DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}" \
-DCMAKE_PREFIX_PATH="${PREFIX_DIR}" \
-DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config ReleaseAll platforms and compilers supported by mulle-c11.
Nat! for Mulle kybernetiK