Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

curl_easy_escape(3) [mojave man page]

curl_easy_escape(3)						  libcurl Manual					       curl_easy_escape(3)

NAME
curl_easy_escape - URL encodes the given string SYNOPSIS
#include <curl/curl.h> char *curl_easy_escape( CURL *curl, const char *string , int length ); DESCRIPTION
This function converts the given input string to a URL encoded string and returns that as a new allocated string. All input characters that are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version (%NN where NN is a two-digit hexadecimal number). If length is set to 0 (zero), curl_easy_escape(3) uses strlen() on the input string to find out the size. You must curl_free(3) the returned string when you're done with it. AVAILABILITY
Added in 7.15.4 and replaces the old curl_escape(3) function. RETURN VALUE
A pointer to a zero terminated string or NULL if it failed. EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { char *output = curl_easy_escape(curl, "data to convert", 15); if(output) { printf("Encoded: %s ", output); curl_free(output); } } SEE ALSO
curl_easy_unescape(3), curl_free(3), RFC3986 libcurl 7.54.0 February 03, 2016 curl_easy_escape(3)

Check Out this Related Man Page

curl_easy_unescape(3)						  libcurl Manual					     curl_easy_unescape(3)

NAME
curl_easy_unescape - URL decodes the given string SYNOPSIS
#include <curl/curl.h> char *curl_easy_unescape( CURL *curl, const char *url , int inlength, int *outlength ); DESCRIPTION
This function converts the given URL encoded input string to a "plain string" and returns that in an allocated memory area. All input char- acters that are URL encoded (%XX where XX is a two-digit hexadecimal number) are converted to their binary versions. If the length argument is set to 0 (zero), curl_easy_unescape(3) will use strlen() on the input url string to find out the size. If outlength is non-NULL, the function will write the length of the returned string in the integer it points to. This allows an escaped string containing %00 to still get used properly after unescaping. Since this is a pointer to an int type, it can only return a value up to INT_MAX so no longer string can be unescaped if the string length is returned in this parameter. You must curl_free(3) the returned string when you're done with it. AVAILABILITY
Added in 7.15.4 and replaces the old curl_unescape(3) function. RETURN VALUE
A pointer to a zero terminated string or NULL if it failed. SEE ALSO
curl_easy_escape(3), curl_free(3),RFC3986 libcurl 7.54.0 October 04, 2016 curl_easy_unescape(3)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace spaces

Hi guys, so I have another issue. Can I use sed to replace spaces in a string or variable with %20 I am having trouble with using curl on URL's containing spaces Thanks! (12 Replies)
Discussion started by: tret
12 Replies

2. Shell Programming and Scripting

URL call from SHELL script

My system does not have wget, curl and lynx. The chances are low that the SA would install them for me. Do I have any other way out? I need to invoke a few URL calls from my SHELL script. Thought of using a PERL script or writing a simple Java client, but that adds in more dependencies. Any... (37 Replies)
Discussion started by: chengwei
37 Replies

3. Shell Programming and Scripting

Replacing one Char in a string of variable length

Hi all, I am trying to find the best way of making a change to 1 char in a string, the string can be between 1 and 14 characters. I am reading a line in from a file which contains 012341231231:2:102939283:NNN: Require :NBN: 012838238232:3:372932:NNN: Require :NNB: I need to change 1 N or a... (8 Replies)
Discussion started by: nkwilliams
8 Replies

4. Programming

How to find length of string and pass into char array in C?

Hi All I want to take a Hexadecimal number as input and i want to find lenth of the input and pass it to char s ( char s ). I have a program to convert hexadecial to binary but it is taking limited input but i want to return binary number based on input. How? (1 Reply)
Discussion started by: atharalikhan
1 Replies

5. Shell Programming and Scripting

Downloading of dynamically generated URL using curl and sed

I've been attempting to use curl and sed to allow for downloading a file from a dynamically generated URL. I've been able to retrieve and save the HTML of the page that does the dynamic generation of the download URL using curl but I'm very new to sed and I seem to be stuck at this part. HTML: ... (1 Reply)
Discussion started by: schwein
1 Replies

6. UNIX for Advanced & Expert Users

Syntax issue in curl for getting a file from http site

Hi All I am using curl in my client environment. We need to pull a file from the libraries site. All the files are having perticular URL which can be used to get the files. Only issue is, when we fire that command , it will take to authentication page 1st. once authentication is succed, it will... (1 Reply)
Discussion started by: prabirkumardhar
1 Replies

7. Shell Programming and Scripting

fire an URL using shell script

Hi, Can anyone tell me how to fire an URL using a shell script? :wall: (8 Replies)
Discussion started by: arijitsaha
8 Replies

8. Shell Programming and Scripting

Encapsulating output of CURL and/or WGET

i use curl and wget quite often. i set up alarms on their output. for instance, i would run a "wget" on a url and then search for certain strings within the output given by the "wget". the problem is, i cant get the entire output or response of my wget/curl command to show up correctly in... (3 Replies)
Discussion started by: SkySmart
3 Replies

9. Shell Programming and Scripting

How to Parse the XML data along with the URL in Shell Script?

Hi, Can anybody help to solve this. I want to parse some xmldata along with the URL in the Shell. I'm calling the URL via the curl command Given below is my shell script file export... (7 Replies)
Discussion started by: Megala
7 Replies

10. Shell Programming and Scripting

Get file names from string

Hello folks, would like as for your help. I'm downloading list of files which need to be downloaded later. Via curl I'm getting this output: % Total % Received % Xferd Average Speed Time Curr. Dload Upload Total Current Left ... (3 Replies)
Discussion started by: brusell
3 Replies

11. Shell Programming and Scripting

Curl/wget shell script to follow redirect.

Hello eveyone. I would like to create a simple batch with curl (or wget) to download a URL but the URL I can only download from the browser and not from shell because curl and wget won't follow the 301 redirect which I get :confused: I tried with curl -L but no luck. I want to hear your opinion.... (5 Replies)
Discussion started by: accolito
5 Replies

12. Shell Programming and Scripting

Highlight 'comm' command output

Given the output below (simplified) extracted from the comparison of two curl -I commands saved in two different files, I am looking for the best approach to highlight the following scenarios in a script: this header exists only in file1.txt but this one does not this one exists in both cases... (1 Reply)
Discussion started by: muppets
1 Replies

13. Shell Programming and Scripting

Using CURL command with special characters in URL

Hi. I 'm trying to hit a REST api and retrieve a JSON feed, and the URL has special characters in it. Something like: Example Domain The below curl command is failing curl -X GET https://www.example.com/?sample=name&id=1001 saying bad command at id=1001 I am going to use this as part... (3 Replies)
Discussion started by: kumarjt
3 Replies

14. Shell Programming and Scripting

Replace line for another line in file

Hey, i have been struggeling to find the answer myself so this is the best forum has alwyas help me :) i have an API that get data from a provider via curl. the data comes like this : AccountCode1234 CompneyNameA Credit: 200 AccountCode5678 CompneyNameB Credit: 200 AccountCode999... (3 Replies)
Discussion started by: batchenr
3 Replies

15. UNIX for Beginners Questions & Answers

Unable to open input kickstart file curl#37

Hi, Getting the below error while installing from ks.cfg unable to open input kickstart file curl#37 Couldn't open file /tmp/swappart Here am trying to include /tmp/swappart file from pre section under disks and partition section. Dont know where exactly am doing wrong My kickstart file... (3 Replies)
Discussion started by: Sumanthsv
3 Replies