/** * Statically call our Readability class and parse * * @return string */ public static function parse($url, $isContent = false) { if ($isContent === false) { $url = file_get_contents($url); } $class = new self($url, false); return $class->getContent(); }
static function quickPost($url, $data) { $bits = parse_url($url); $host = $bits['host']; $port = isset($bits['port']) ? $bits['port'] : 80; $path = isset($bits['path']) ? $bits['path'] : '/'; $client = new self($host, $port); if (!$client->post($path, $data)) { return false; } else { return $client->getContent(); } }
/** * Create fixed server request * * @param array $server * * @return $this */ private static function fixCreateServerRequest(array &$server) { $request = new self($server, $_GET, $_POST, $_COOKIE, $_FILES); // parse parameter from body content from method PUT, DELETE and PATCH. if ($request->getHeaderBag()->has('Content-Type') && 0 === strpos($request->getHeaderBag()->first('Content-Type')->getFieldValue(), 'application/x-www-form-urlencoded') && in_array(strtoupper($request->getServerBag()->get('REQUEST_METHOD', Request::HTTP_METHOD_GET)), array(Request::HTTP_METHOD_PUT, Request::HTTP_METHOD_DELETE, Request::HTTP_METHOD_PATCH))) { parse_str($request->getContent(), $data); $request->request = new ParameterBag($data ?: array()); } return $request; }