Retrieving a page of that has a redirect
- by Dmitry Makovetskiyd
I get my page content with this function:
private function fetch_url($url){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 320);
$this->doc = curl_exec($ch);
$this->status_code= curl_getinfo($ch, CURLINFO_HTTP_CODE);
// echo $this->doc;
curl_close($ch);
}
The problem is that with some urls dont exist on a webpage and there is a redirect to another page..
So say if I put the parameter:
http://example.com/uncategorized/
It redirect me to :
http://example.com/mature/
The problem is with curl, I dont get any content.. But my aim is to get the content of that page redirect..
Is there an easy way to get the function to work in the way I want..?