Skip to content

Tag: php

How is it possible to run an ftp server, using php?

I would like to host az FTP server on: mywebsite.domain/ftpserver.php The XAMPP server runs on my computer. The php is important, because I would like to authenticate the users using their passwords in the mysql database, and their directory’s name is also stored in the database. Or if there is a free f…

Regex validation matching pattern1 and pattern2 in PHP

I need to match a string against two patterns both patterns must match the string. You could imagine it as some sort of validation chain. Patterns in below code are just examples. I know code below is a possible solution, but I’m interested to know can it be done with one preg_match by joining patterns …

PHP: How to split array into 2 parts?

I have an array full of DB records. It could heaps of elements or very little, it changes regularly. I need to split the array into two equal parts. The reason is I am then passing these arrays to a Laravel view and displaying them into separate columns. Here is the DB records being pulled: $books = Book::whe…

Get Gmail All folder IMAP PHP

I want to access the All folder in gmail via imap. in different language and in different name. What should i do? The code of connection is: Answer This is the solution i found for the problem.The idea is that the All folder contains the biggest number of mails so we have to get the number of mails in all

How to use Poedit with smarty templates?

I’m using PoEdit on smarty templates (phtml and tpl files) with the following Poedit configuration for PHP parser : Extensions: Parser command : If i’m using gettext inside PHP tags <?php _(‘test’); ?> Poedit detect that translation as expected. But i’m using Smarty {_(&#82…

Website Scraping from DoMDocument using php

I have a php code that could extract the categories and display them. However, I still can’t extract the numbers that goes along with it too(without the bracket). Need to be separated between the categories and number(not extract together). Maybe do another for loop using Regex, etc… This is the c…