I needed to know my options for htmlentities character encoding support today. The PHP documentation had everything I needed to know. I ended up adding these constants to my code:
const UTF8_ENCODING = 'UTF-8'; const ASCII_ENCODING = 'ISO-8859-1';
I needed to know my options for htmlentities character encoding support today. The PHP documentation had everything I needed to know. I ended up adding these constants to my code:
const UTF8_ENCODING = 'UTF-8'; const ASCII_ENCODING = 'ISO-8859-1';
A great article on Wikipedia about Newlines…
Using PHP Output Buffering Control…
Reading about MySQL Integer Types.
Today I queried the $_SERVER[ ‘SERVER_PROTOCOL’ ] value in PHP to determine the HTTP version used by the request.
Read a good article on using Twitter Bootstrap Dropdown Menus…
All you need to know is on the date documentation…
I wanted to add a new column to my table after the first column, like you can in MySQL. Turns out you can’t do that…
Reading about date/time support in PostgreSQL…
Today I needed to figure out how to read some data from a URL that required HTTP Basic Auth. The solution was pretty simple, use file_get_contents and pass in a configured stream context. I found the following code on the stream_context_create documentation:
$cred = sprintf( 'Authorization: Basic %s',
base64_encode( 'username:password' )
);
$opts = array(
'http' => array(
'method' => 'GET',
'header' => $cred
)
);
$ctx = stream_context_create( $opts );
$data = file_get_contents( $url, false, $ctx );
Easy-peasy!