Quantcast
Browsing all 18 articles
Browse latest View live

PHP: strtolower for Russian and Cyrillic

If you need to work with Russian text in PHP, you may notice that functions that are related to CaSe are not working as expected. I mean strtolower, strtouper, ucwords, and so on. In order to get what...

View Article


Twitter Error 417 – Expectation Failed: PHP Solution

Recently I had to deal with Twitter avatar upload for a Twitter application. Everything went very well, but when I have prepared everything for the upload query, the only server response I got was...

View Article


How to Delete a Cookie With PHP

Working with cookies is essential when you create websites, that track user activity on the site. Sometimes you need to delete cookies you previously set. Since cookies are small files that are stored...

View Article

How to Reset the Array of Mail Recipients using PHPMailer

Today I had to fix a script that sends an e-mail using PHPMailer. Here is the intital code: $mail->From = “lampdocs@gmail.com”; $mail->FromName = “Lampdocs.com”;...

View Article

CaSe Insensitive substr_count in PHP: Is There any Elegant Solution?

Recently I’ve been searching for case insensitive version of substr_count in PHP. I haven’t found any elegant solution, so let me post the simple code that does the trick....

View Article


How to Send a Refund with Paypal API – PHP Solution

Just wanted to paste a PHP solution for a Paypal refund. It was found on Paypal official site, but I spent some time to get it.   [code type=php]

View Article

How to Show Only Duplicate Values From an Array With PHP

If you have an array with duplicate values, sometimes you might need to show only non-unique elements. Here is a short code in PHP that will allow you to do this. <? $arr=array_map("trim",...

View Article

SSL read: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure,...

After another PHP recompilation I’ve started getting the following error while trying to access SSL websites with cURL: 56 SSL read: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure,...

View Article


How to Open Links in a New Tab in Hesk 2.5.2

If you have used Hesk before, you must have mentioned that all links that were posted by users at the time of ticlet creation/reply were opening in new tabs. If you decide to update to 2.5.2 (I was...

View Article


Setting Timeout Value for file_get_contents in PHP

Sometimes you need to avoid using cURL for getting external web content for any reasons. You’re lucky that PHP has some built-in functions that allow you to get data from the Web without cURL. But if...

View Article

SMTP ERROR: Failed to connect to server: Connection refused (111) –...

Sometimes users need to send outgoing e-mails with external SMTP servers. Most popular example is PHPMailer with its ability to use free SMTP servers, for example Gmail. Here is the short piece of...

View Article

How to Show Current Query When Using Activerecord in Yii2

Today just a simple command. If you need to know the current query for an Activerecord object, you need this simple command: $query->createCommand()->getRawSql(); This will show current SQL...

View Article

How to Enable Optional Trailing Slash in Yii2 URLs

Inspired from Github If you have links, that might end with slashes (sometimes they are being added automatically), you won’t be able to handle them unless you add a string to your Yii2 project...

View Article


How to Set Up Custom HTTPD Configuration for Yii2 on a Directadmin Server...

Today I’m coming with a setting for Yii2, as I haven’t found any documentation about this. So we will set up advanced template of Yii, on a Directadmin server, running on nginx. First of all, you need...

View Article

How to convert small value in PHP like 1.0 E-5 to “normal” view

Sometimes you might have small numbers in PHP. So small, that they are automatically converted to exponential format. In order to show them as numbers, here is the code: $number=...

View Article


Image may be NSFW.
Clik here to view.

How to Generate Multisig Bitcoin Addresses with the list of xpubs in PHP

Another script, that I had to create by myself, since I haven’t found a solution for such a simple task. Let’s say you create a multisig Bitcoin wallet in Electrum. Let’s start with a basic version...

View Article

How to Query an ElectrumX Server with PHP

Spent several hours today figuring out how to interact with an ElectrumX server, and it resulted into just several lines of code. I hope this will save someone time. I will show 2 versions – for TCP...

View Article


How to get the Redeem Script for a P2SH Address From Private Key with PHP

Just a quick piece of code, that is using Bitwasp library to mare redeem script from private key <?php require __DIR__ . "/vendor/autoload.php"; use BitWasp\Bitcoin\Key\Factory\PrivateKeyFactory;...

View Article
Browsing all 18 articles
Browse latest View live