Tag Archives: dom

PHP get the content type header of DOMDocument loaded from url

Questions: I’m retrieving an XML document (in this case an RSS feed) from a remote source using the DOMDocument feature of PHP. It returns the XML as a DOM object and I can access content of the XML tags like this: $url = $_POST[‘url’]; // eg. http://example.com/page.xml $xmlDoc = new DOMDocument(); $xmlDoc -> load($url); $channel… Read More »

Masking Domain Automatically

Questions: My question is similar to this : Domain masking/pointing to a directory of a web application?. I just want to clarify, is there any other approach? And which one is better? I’m using laravel, nginx, mongodb, (and bind to simulate DNS configuration). Say I have web application in mydomain.com, which every users can create… Read More »

Session got destroyed automatic (randomly)

Questions: I’ve a website where we’ve a lot of subdomains + our main website on the same domain (the website is coded in Codeigniter). For example: sub.domain.com sub1.domain.com sub2.domain.com domain.com Our main domain is used as the system for our clients and the subdomains is where our clients customers can make a booking. We’ve a… Read More »

DOMDocument :: validate returning false on valid HTML

Questions: So I have the following php code, where $description is some html snippet returned from user input. I want to check whether that snippet is valid using PHP’s DOMDocument, however it’s returning false for valid HTML. $dom = new DOMDocument(); $dom->loadHTML(‘<html><body>’ . $description . “</body></html>”); if ($dom->validate()) { echo “html is valid<br>” } else… Read More »

How do I rename a filename to a random filename in PHP?

Questions: I have a .php file with a random name. And I want to rename it to something another random name when a specific button was hit. function generateRandomString($length = 10) { $characters = ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’; $charactersLength = strlen($characters); $randomString = ”; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength -… Read More »

Reinitialize Vue.js component after DOM changed after ajax

Questions: I have a PHP application with Vue.js advantage. The main vue obj looks as so: window.vm = new Vue({ el: ‘#app’ }); Also there are some globally registered components. There are already tabs that are linked through ajax (re-render DOM html). In one of them I want to add a Vue component <widget-pro></widget-pro> After… Read More »

Exclude subdomain from 301 redirect simple way

Questions: how to exclude subdomain from 301 redirects. I have tried all the solutions mention on the internet but no fix. Can someone help? { RewriteCond %{HTTPS} offRewriteCond %{HTTP_HOST}^www\.NC] RewriteRule ^https://domain.in%{REQUEST_URI} [L,NE,R=301] RewriteCond %HTTP_HOST}!^(subdomain)\.domain\.in$[NC] } Answers: