Looks legit...
What could go wrong?!
Like Take Time to Sit with Your Thoughts | Žan Černe...
"As simple as this act is, when was the last time you sat on a bench and simply enjoyed life?"
I try to do this when at work – if it's nice I take a break, go for a walk and sit on a bench to watch and listen to the birds. It completely resets the mind.
I never knew you could (should?) set the character encoding when performing a loadHTML()
into a DOMDocument()
.
When pulling the title tag from remote pages (e.g. when doing a 'like') it would often not return characters correctly.
By specifying 'UTF-8' for both the curl request and DOMDocument it's fixed the problem:
$url = 'https://example.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
$response = curl_exec($ch);
curl_close($ch);
$dom = new DOMDocument();
$dom->loadHTML('<?xml encoding="UTF-8">' . $response);
@colinwalker Wow, they're not even trying. 0/5 stars–poor effort. 😂
🤣