PHP curl_escape Function |
-- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
PHP Tutorial
- PHP Tutorial
- PHP Introduction
- PHP Installation
- PHP Syntax
- PHP Variables
- PHP echo/print
- PHP EOF(heredoc)
- PHP Data Types
- PHP Type Comparison
- PHP Constants
- PHP String
- PHP Operators
- PHP If...Else
- PHP Switch
- PHP Arrays
- PHP Array Sorting
- PHP Superglobals
- PHP While Loop
- PHP For Loop
- PHP Functions
- PHP Magic Constants
- PHP Namespaces
- PHP OOP
- PHP Quiz
PHP Forms
- PHP Forms
- PHP Form Validation
- PHP Form - Required Fields
- PHP Form - Validate Email and URL
- PHP Complete Form Example
- PHP $_GET Variable
- PHP $_POST Variable
PHP Advanced Tutorial
- PHP Multidimensional Arrays
- PHP Date
- PHP Include
- PHP File
- PHP File Upload
- PHP Cookie
- PHP Session
- PHP E-mail
- PHP Secure E-mail
- PHP Error
- PHP Exception
- PHP Filter
- PHP Advanced Filter
- PHP JSON
PHP 7 New Features
PHP Database
- PHP MySQL Introduction
- PHP MySQL Connect
- PHP MySQL Create Database
- PHP MySQL Create Table
- PHP MySQL Insert Data
- PHP MySQL Insert Multiple Data
- PHP MySQL Prepared Statements
- PHP MySQL Read Data
- PHP MySQL Where
- PHP MySQL Order By
- PHP MySQL Update
- PHP MySQL Delete
- PHP ODBC
PHP XML
PHP and AJAX
PHP Reference Manual
- PHP Array
- PHP Calendar
- PHP cURL
- PHP Date
- PHP Directory
- PHP Error
- PHP Filesystem
- PHP Filter
- PHP FTP
- PHP HTTP
- PHP Libxml
- PHP Mail
- PHP Math
- PHP Misc
- PHP MySQLi
- PHP PDO
- PHP SimpleXML
- PHP String
- PHP XML
- PHP Zip
- PHP Timezones
- PHP Image Processing
- PHP RESTful
- PHP PCRE
- PHP Available Functions
- PHP Composer
PHP curl_escape Function
(PHP 5 >= 5.5.0)
curl_escape β URL-encodes the given string.
Description
string curl_escape ( resource $ch , string $str )
This function URL-encodes the given string according to Β» RFC 3986.
Parameters
ch
A cURL handle returned by curl_init().
str
The string to be encoded.
Return Values
Returns the encoded string, or FALSE on failure.
Example
<?php
// Create a cURL Handle
$ch = curl_init();
// Encode GET Parameters
$location = curl_escape($ch, 'HofbrΓ€uhaus / MΓΌnchen');
// Result: Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// Compare the Encoded URL
$url = "http://example.com/add_location.php?location={$location}";
// Result: http://example.com/add_location.php?location=Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// Send HTTP Request and Close Handle
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
?>
YouTip