(PHP Extension) Example: Http.HasRequestHeader method
Demonstrates the HasRequestHeader method.
<?php
include("chilkat.php");
$http = new CkHttp();
$http->SetRequestHeader('X-CSRF-Token','Fetch');
$b = $http->HasRequestHeader('X-CSRF-Token');
if ($b == true) {
print 'X-CSRF-Token: Yes' . "\n";
}
else {
print 'X-CSRF-Token: No' . "\n";
}
$b = $http->HasRequestHeader('X-Something');
if ($b == true) {
print 'X-Something: Yes' . "\n";
}
else {
print 'X-Something: No' . "\n";
}
// The Accept and Accept-Encoding headers are default headers automatically added,
// unless the application chooses to remove by calling RemoveRequestHeader for each.
$b = $http->HasRequestHeader('Accept');
if ($b == true) {
print 'Accept: Yes' . "\n";
}
else {
print 'Accept: No' . "\n";
}
// Output:
// X-CSRF-Token: Yes
// X-Something: No
// Accept: Yes
?>
|