PHP | List all folders in the mailbox

$mbox = imap_open(“{mail.example.com:143/novalidate-cert}”, “foo@example.com”, “password”) or die(“can’t connect: ” . imap_last_error()); $folders = imap_list($mbox, “{mail.example.com:143/novalidate-cert}”, “*”); if ($folders === false) { echo “Failed to list folders in mailbox”; } else { print_r($folders); } imap_close($mbox);

MySQL – OPTIMIZE all tables with PHP and mysqli

$alltables = mysqli_query($conn, "SHOW TABLES"); while ($table = mysqli_fetch_assoc($alltables)){ foreach ($table as $db => $tablename){ echo "OPTIMIZE TABLE `".$tablename."`"; mysqli_query($conn, "OPTIMIZE TABLE `".$tablename."`") or die(mysqli_error()); echo "<br>"; } }

PHP – Replace last occurrence in a String

<?php function str_lreplace($search, $replace, $subject) { $pos = strrpos($subject, $search); if($pos !== false) { $subject = substr_replace($subject, $replace, $pos, strlen($search)); } return $subject; } $search = ".Maui"; $replace = "is awesome"; $subject = ".Maui .Maui";…

CSS Minify API 1.2 released!

We have just released a new version of the API to minimize CSS. Based on your feedback we have added four new parameters: removeurlquotes: Removes quotes from urls. Default is true.removecomments: Removes all comments. Default…

PHP display all errors and warnings

When writing a program in PHP it is a good idea to activate all the errors and warnings that often occur during development. Many hosts have the display of errors disabled, so you can ‘go…

Convert URLs and HTML Code to PDF with PHP

Our API is a free solution for converting web pages and HTML documents to PDF with PHP. Here is a simple example: <?php $data = array(“apikey” => “YOUR_API_KEY”, “html” => “<p>My first pdf with <b>.Maui…

How to parse an xml sitemap using PHP and Curl

<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ‘https://www.example.com/sitemap.xml’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch,CURLOPT_USERAGENT,’Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36′); $resp = curl_exec ($ch); $xml = new SimpleXMLElement($resp); foreach ($xml->url…