47 $pos = strpos(
$req,
'://');
48 $this->_protocol = strtolower(substr(
$req, 0, $pos));
51 $pos = strpos(
$req,
'/');
55 $host = substr(
$req, 0, $pos);
57 if (strpos($host,
':') !==
false) {
58 list($this->_host, $this->_port) = explode(
':', $host);
61 $this->_port = ($this->_protocol ==
'https') ? 443 : 80;
64 $this->_uri = substr(
$req, $pos);
65 if ($this->_uri ==
'') {
83 $req =
'GET ' . $this->_uri .
' HTTP/1.0' . $crlf
84 .
'Host: ' . $this->_host . $crlf
88 $this->_fp = fsockopen(($this->_protocol ==
'https' ?
'ssl://' :
'') . $this->_host, $this->_port);
89 fwrite($this->_fp,
$req);
90 while (is_resource($this->_fp) && $this->_fp && !feof($this->_fp)) {
101 $body = substr(
$response, $pos + 2 * strlen($crlf));
105 $lines = explode($crlf,
$header);
106 foreach ($lines as $line) {
107 if (($pos = strpos($line,
':')) !==
false) {
108 $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos+1));
113 if (isset($headers[
'location'])) {
Create styles array
The data for the language used.