I use DOMDocument for editing some HTML files, but some of theme have in their names spaces. So DOMDocument automaticly change the spaces to %20 and then can’t find them. This is how looks the error exactly: How to repair this error? Answer Use DOMDocument::loadHTMLFile() instead of load(). That’s…
When I save span with style to MySQL, style is deleted
I am using TinyMCE for my PHP/CodeIgniter CMS back-end input. However when I use a text color, some of codes are not saved and does not show the correct color. How can I solve this problem? Thanks …
failed to open stream: HTTP wrapper does not support writeable connections
I have uploaded my localhost files to my website but it is showing me this error:- What i personally feel that the contents get saved in a file in cache folder and when i uploaded the files to my web server it is trying to access the cached localhost folder. Answer Instead of doing file_put_contents(***WebSit…
Three curly brackets together in php source code
I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]). They are often using three curly brackets together as given below (The following code snippet extracted form ext/…
Submitting a form using
I’m having a little trouble with this and can’t see what I’m doing wrong. I have this form: So when the user clicks the button it should submit the form then have this PHP to act upon the form (I know that the sql isn’t a prepared statement and is vulnerable to injections but this will…
PHP $_GET/$_POST via variable variables
I’m attempting to dynamically access both the $_GET and $_POST arrays, among others, using variable variables. The reason I’m trying to do this is so that I can perform similar actions on multiple arrays without needing to declare specific iterations for each. I’m reasonably sure this is pos…
Get YouTube video title in PHP
In one of my applications I am saving a YouTube video’s id… Like “A4fR3sDprOE”. I have to display its title in the application. I got the following code for getting its title and also it’s working fine. Now the problem is if any error occurred (in case of a delete of the video) P…
glob() can’t find file names with multibyte characters on Windows?
I’m writing a file manager and need to scan directories and deal with renaming files that may have multibyte characters. I’m working on it locally on Windows/Apache PHP 5.3.8, with the following file names in a directory: filename.jpg имяфайла.jpg file件name.jpg פילענאַמע.jpg 文件名.jpg Testing on a l…
Delete folder in Amazon S3 using PHP
I just started trying out Amazon S3 for hosting my website’s images. I’m using the official Amazon AWS PHP SDK library. Problem: How can I delete all files located in a S3 ‘folder’? For example if I …
php array sorting with accents
I am using this to sort according to last name: But – when in last name is accent, e.g. Šiko, Áron, etc, these names are at the end. How can I sort it properly? Answer Use multi-byte string functions. There is a function called strcoll which seems to suit your needs. More info: On how to sort an array o…