PHP – http:// wrapper is disabled in the server configuration by...
If you find these 2 errors in the error log. …file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in… …failed to open stream:...
View ArticlePHP – String to DateTime and vice versa
// Assume you have a date string which is in d-m-Y format. $date_string = '18-04-2013'; // Create the DateTime object $date = date_create_from_format('d-m-Y', $date_string); // Print the date in Y-m-d...
View ArticlePHP – Parse string into date and date comparison
// Get the date in string with Y-m-d format $exp_date_s = "2013-04-22"; $today_s = date("Y-m-d"); // Convert the dates into timestamp $exp_date = strtotime($exp_date_s); $today = strtotime($today_s);...
View ArticlePHP – Create multiple galleries in a single page using UberGallery
The UberGallery is a very handy PHP tool to create image galleries. After the setup, it will automatically detect the image files in the folder and generate the thumbnail view on the webpage. It also...
View ArticlePHP – Sort a multidimensional array by specific key
Assume you have the following array in PHP. $myArray = array( 0 => array( 'hashtag' => 'a7e87329b5eab8578f4f1098a152d6f4', 'title' => 'Flower', 'order' => 3 ), 1 => array( 'hashtag'...
View ArticleComposer – Manage your PHP dependencies
Mess up with the PHP dependencies in different environments? Composer is a PHP dependency manager where all the dependencies information are stored in the JSON file called composer.json. Similar to the...
View ArticleConnect Drupal 8 RESTful Service with Guzzle PHP Web Service Client @ 1
Previously I have setup a a Drupal 8 which is RESTful ready. Drupal 8 – Setup the RESTful Service @ 1 Guzzle is a PHP HTTP client & framework for building RESTful web service clients. In this...
View ArticleDrupal 8 – Login in Guzzle Web Service Client @ 1
1. Get your PHP client ready by following my previous post. Connect Drupal 8 RESTful Service with Guzzle PHP Web Service Client @ 1 2. Update your index.php as follow. <?php require...
View ArticleDrupal 8 – Create a node through RESTful Web Service @ 1
In the previous posts, we have gone through some examples about working with Drupal 8 RESTful web service. Drupal 8 – Setup the RESTful Service @ 1 Connect Drupal 8 RESTful Service with Guzzle PHP Web...
View ArticlePHP – Insert and element into a specific position of an Array
Originally we have an array as follow $fruits = array( '0' => 'apple', '1' => 'banana', '2' => 'pear', ); So i want to insert “melon” into the 2nd position which is after “apple”. We can do...
View Article