Skip to Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

13.7 Eine HTTPS-URL abrufen

Problem

Sie möchten eine sichere URL auslesen.

Lösung

Verwenden Sie file_get_contents() mit einer HTTPS-URL:

$page = file_get_contents("https://sicher.example.com/kontostand.php");

Falls der https://-Wrapper nicht zur Verfügung steht, verwenden Sie die cURL-Erweiterung mit einer HTTPS-URL:

$c = curl_init('https://sicher.example.com/kontostand.php');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);

Diskussion

Um sichere URLs mit file_get_contents() abrufen zu können, muss PHP mit --with-openssl kompiliert worden sein. Die cURL-Erweiterung auf eine SSL-Bibliothek wie zum Beispiel OpenSSL zugreifen können. Diese Bibliothek muss beim Build von PHP und der cURL-Erweiterung verfügbar sein. Abgesehen ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi

Publisher Resources

ISBN: 9783868993271Purchase book