Jump to content

how to cURL with Obj C?


Go to solution Solved by SoloTurk,

3 posts in this topic

Recommended Posts

Posted

Hey, so im trying to make commands for my tweak! so I would be using cURL (i think) and it would be a HTTP GET, 

 

so for example if i wrote $ud niro in the text box and hit enter it would return https://K8.reko.io/v1/api?ud=niro, how would i make it so that it carries over the "niro" and puts it into the url?

 

Even better how could i make it return all the data from the GET?

 

if ([command hasPrefix:@"$ud"]) command =@"https://K8.reko.io/v1/api?ud=";

 

 

here is what i have, so if i wrote $ud it returns the URL, im trying to get it to be if i typed $ud niro it returns the url and =niro at the end? and if possible how could i make it return the get response so if i typed $ud niro it returns in the command=@"GET DATA HERE"

 

 

sorry for being confusing :S

  • Solution
Posted (edited)


NSURL *url = [NSURL URLWithString:@"https://xx/"];

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];

[req setHTTPMethod:@"POST"];

//... set everything else


NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:some];

 

Updated by SoloTurk
Posted (edited)

Hey, so im trying to make commands for my tweak! so I would be using cURL (i think) and it would be a HTTP GET,

 

so for example if i wrote $ud niro in the text box and hit enter it would return https://K8.reko.io/v1/api?ud=niro, how would i make it so that it carries over the "niro" and puts it into the url?

 

Even better how could i make it return all the data from the GET?

 

if ([command hasPrefix:@"$ud"]) command =@"https://K8.reko.io/v1/api?ud=";

 

 

here is what i have, so if i wrote $ud it returns the URL, im trying to get it to be if i typed $ud niro it returns the url and =niro at the end? and if possible how could i make it return the get response so if i typed $ud niro it returns in the command=@"GET DATA HERE"

 

 

sorry for being confusing :S

So you're basically trying to prefix a string...

Try this:

// Other code here...
NSString *url = @"https://k8.reko.io/v1/api?ud=";
NSMutableString *userInput = NSMutableString.alloc.init;
// User input Code here
[userInput stringByAppendingString:(@"%@", userInput )];
// Do something with the string 
Updated by KingRalph

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines