HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

curl_escape

Description

The curl_escape of cURL for PHP uRL encodes the given string.

Syntax

curl_escape(
    CurlHandle $handle,
    string $string
): string|false

Parameters

handle

A cURL handle returned by curl_init().

string

The string to be encoded.

Return

Returns escaped string or false on failure.

Examples

1 · handle string

<?

$handle = curl_init();

    $string = 'Hofbräuhaus / München';

    $return = curl_escape($handle, $string);

    curl_setopt($handle, CURLOPT_URL, "https://osbo.com?location=$return");

    curl_exec($handle);

curl_close($handle);

echo $string . PHP_EOL;
echo $return;
Hofbräuhaus / München
Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen