Created
May 3, 2021 15:12
-
-
Save danialdezfouli/7f6eaa4e6b08ac302063a23a55a00fee to your computer and use it in GitHub Desktop.
Simple Class to Fetch a URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Domain | |
{ | |
protected $path; | |
function __construct($domain = 'https://www') | |
{ | |
$this->path = $domain; | |
} | |
function __get($domain) | |
{ | |
return new Domain($this->path ? $this->path . '.' . $domain : $domain); | |
} | |
function __toString() | |
{ | |
return file_get_contents($this->path); | |
} | |
} | |
$www = new Domain(); | |
echo $www->example->com; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That got me!