Retrieving a page of that has a redirect
Posted
by
Dmitry Makovetskiyd
on Stack Overflow
See other posts from Stack Overflow
or by Dmitry Makovetskiyd
Published on 2012-10-14T09:33:58Z
Indexed on
2012/10/14
9:36 UTC
Read the original article
Hit count: 210
php
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..?
© Stack Overflow or respective owner