Hello,
klingt fast genauso bequem, wie file_get_contents().
Ist cURL innerhalb PHP auch so leisgtungsstark, wie standalone?
Wie kommt man da an die Ergebnisse der einzelnen Stufen?
Setze die Curl-Option CURLOPT_VERBOSE
auf true
:
<?php
$dst_url = 'https://www.example.com';
header( 'Content-Type text/plain' );
error_reporting( E_ALL );
ini_set( 'display_errors', 1);
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $dst_url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'HEAD' );
curl_setopt( $ch, CURLOPT_NOBODY, true );
### So geht das:###
curl_setopt( $ch, CURLOPT_VERBOSE, true );
$result = curl_exec( $ch );
print_r( curl_getinfo( $ch ) );
curl_setopt( $ch, CURLOPT_VERBOSE, true );
Die zusätzlichen Ausgaben sind dann:
* Trying 77.1.64.9:443...
* TCP_NODELAY set
* Connected to home.fastix.org (77.1.64.9) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: CN=code.fastix.org
* start date: Dec 22 19:54:50 2021 GMT
* expire date: Mar 22 19:54:49 2022 GMT
* subjectAltName: host "home.fastix.org" matched cert's "home.fastix.org"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
> HEAD / HTTP/1.1
Host: home.fastix.org
Accept: */*
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Sat, 05 Feb 2022 15:29:59 GMT
< Server: Apache/2.4.52
< Last-Modified: Thu, 08 Oct 2020 07:41:54 GMT
< ETag: "24f12-186-5b123f751f381"
< Accept-Ranges: bytes
< Content-Length: 390
< Vary: Accept-Encoding
< Permissions-Policy: interest-cohort=()
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host home.fastix.org left intact