function doRequest($url) { $request = new httpRequest(wm_server_address); $request->setUserAgent('websiteMasterClient.php'); $request->setTimeout(wm_server_timeout); $postData = json_encode(['act' => 'render', 'data' => ['url' => $url]]); $request->setPOST($postData); $request = $request->exec(); if ($request['status'] != 'OK') { return [false, $request['message'], true]; } $reqData = json_decode($request['data'], true); if (!$reqData) { return [false, 'Invalid response data', false]; } if ($reqData['status'] != 'OK') { return [false, $reqData['message'], false]; } $contentType = $reqData['content_type']; $content = $reqData['data']; return [true, [$contentType, $content], false]; }