Sample code for 30+ languages & platforms
PHP ActiveX

Example: Http.QuickGetStr method

Demonstrates the QuickGetStr method.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$http = new COM("Chilkat.Http");

// Keep the response body if there's an error.
$http->KeepResponseBody = 1;

// Send the HTTP GET and return the content in a string.
$str = $http->quickGetStr('https://www.chilkatsoft.com/helloWorld.json');
if ($http->LastMethodSuccess == 0) {
    if ($http->LastStatus == 0) {
        // Communications error.  We did not get a response.
        print $http->LastErrorText . "\n";
    }
    else {
        print 'Response status code: ' . $http->LastStatus . "\n";
        print 'Response body error text:' . "\n";
        print $http->LastResponseBody . "\n";
    }

    exit;
}

print $str . "\n";
print 'Success' . "\n";

?>