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

curl_escape

Description

The curl_escape cURL for PHP uRL encodes the given string.

Syntax

curl_escape ( resource $ch , string $str ) : string

Parameters

ch

A cURL handle returned by curl_init().

str

The string to be encoded.

Return

Returns escaped string or FALSE on failure.

Examples

1

<?

$ch = curl_init();

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

    $return = curl_escape($ch, $str);

    curl_setopt($ch, CURLOPT_URL, "https://www.php.net?location=$return");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_exec($ch);

curl_close($ch);

echo $str . PHP_EOL;
echo $return;

?>
Hofbräuhaus / München
Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
HomeMenu