} } } } public function getHeader() { return $this->pageHeader; } public function getHtmlUrl() { return $this->htmlurl; } public function getImageHolder() { return $this->imageHolder; } public function getBodyHolder() { return $this->bodyHolder; } } $htmlParser = new HTMLParser($_POST["cnnurl"]); // echo $object->getHtmlUrl(); echo $htmlParser->getHeader(); $imagePlaceHolder = $htmlParser->getImageHolder(); echo $imagePlaceHolder[0]; // Saw that only the first position image is relavent in most of the articles. Hence using only 0 instead of the for loop. $bodyHolder = $htmlParser->getBodyHolder(); foreach ($bodyHolder as $content) { echo $content; }