How to replace file_get_html using cURL?

the parsing of the page happens using simple_html_dom.
I need to get headers that exist when you load the desired page.

$data = file_get_html($url);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);

but when I output $result to get
string(51) "Moved Permanently. Redirecting to /myaccount/login/"

I was expecting something more....

If at all possible equivalent to replace this function using curl?
To still to put....
June 14th 19 at 20:51
2 answers
June 14th 19 at 20:53
June 14th 19 at 20:55
Obviously, the answer came with the 301 code, the requested page should look at a different location, a little bit of Wikipedia on the topic. And here about the options that you kurlu ask, in this case, CURLOPT_FOLLOWLOCATION interesting.

Find more questions by tags PHP