Urlencoding is required in a number of situations. For example, API tokens need to be urlencoded or they will be rejected as invalid.
Wikitext
You can URL encode a string from the wikitext using this magic word:
{{urlencode: VERY LONG EXAMPLE & SOMETHING }}
Result:
VERY+LONG+EXAMPLE+%26+SOMETHING
PHP
Settings headers
Typical code for setting headers, e.g. for API:Edit, would be:
curl_setopt( $this->curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/x-www-form-urlencoded' ) );
See also
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.