$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
+ $statuscode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
- if (empty($result)) {
+ if ($statuscode !== 200 || empty($result) || (!$result = json_decode($result, true))) {
behat_error (BEHAT_EXITCODE_REQUIREMENT, $CFG->behat_wwwroot . ' is not available, ensure you specified ' .
'correct url and that the server is set up and started.' . PHP_EOL . ' More info in ' .
}
// Check if cli version is same as web version.
- $result = json_decode($result, true);
$clienv = self::get_environment();
if ($result != $clienv) {
$output = 'Differences detected between cli and webserver...'.PHP_EOL;