<?php class classSecurityBasicAuth { public $zmienna = ''; public function __construct($url, $komunikat) { $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_NOBODY, true); curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if ($httpCode == 200) { $this -> zmienna = '<img src="'.$url.'" />'; } else { $this -> zmienna = $komunikat; } curl_close(); } public function funkcja() { return $this->zmienna; } } $security = new classSecurityBasicAuth('http://c.allegrostatic.pl/images/velalayout/434de666.allegro-logo.png', '<img src= "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Nie_istnieje.svg/100px-Nie_istnieje.svg.png"/>'); ?>
Uprzedzam. Chodzi czy dobrze konstruuje
