JavaScript, PHP, html5, CSS, Rewrite, GMap, ...

Kategorie
  • CSS (97)
  • Docker (3)
  • Github (1)
  • GMap (47)
  • Hosting (1)
  • htaccess (18)
  • HTML (70)
  • HTTP (8)
  • Intellij IDEA (6)
  • JavaScript (210)
  • jQuery (27)
  • JSON (3)
  • Leaflet (7)
  • Linux (46)
  • MySQL (33)
  • Nauka (2)
  • Nodejs (4)
  • Opera (1)
  • Perl (17)
  • PHP (139)
  • PostgreSQL (34)
  • Programy (11)
  • React (6)
  • Rejestr (3)
  • Rewrite (9)
  • Smarty (27)
  • SQL (19)
  • SQL Server (10)
  • SVG (4)
  • System (11)
  • Telefony (6)
  • VBA (7)
  • VBSCRIPT (32)
  • Windows (24)
  • Wordpress (24)
  • WYSIWYG (6)
  • XML (6)

Tag: base64_encode

12 Lis 2008

Autoryzacja użytkownika w PHP

przez fsockopen: 

$header .= 'GET ... HTTP/1.0'."\r";
$header .= 'Host: '.$domain."\r";
$header .= 'Authorization: Basic '. base64_encode('login:haslo')."\r";
$header .= "\r"; 

$fp = @fsockopen ($host, 80, $errno, $errstr, 10);

if (!$fp) {
 $ret_value = "$errstr ($errno)";
} else {
 ...
}

przez stream_context_create:

$ctx = stream_context_create(
 array(
   'http' => array(
   'timeout' => 12,
   'header' => 'Authorization: Basic '. base64_encode('login:haslo')
  )
 )
);
$xml_data = file_get_contents($url, 0, $ctx);
Authorization base64_encode Basic file_get_contents fsockopen header login stream_context_create timeout
Copyright © | kodyWiG Theme