Skip to content
Snippets Groups Projects
Commit c3283a53 authored by Tim Steiner's avatar Tim Steiner
Browse files

Add header parsing code to the import tool.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@118 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent fc8d8b84
No related branches found
No related tags found
No related merge requests found
......@@ -449,9 +449,22 @@ class Unl_Migration_Tool
curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($this->_curl, CURLOPT_HEADER, TRUE);
echo 'Retreiving ' . $url . PHP_EOL;
$content = curl_exec($this->_curl);
$data = curl_exec($this->_curl);
$meta = curl_getinfo($this->_curl);
$content = substr($content, $meta['header_size']);
$rawHeaders = substr($data, 0, $meta['header_size']);
$rawHeaders = trim($rawHeaders);
$rawHeaders = explode("\n", $rawHeaders);
array_shift($rawHeaders);
$headers = array();
foreach ($rawHeaders as $rawHeader) {
$splitPos = strpos($rawHeader, ':');
$headerKey = substr($rawHeader, 0, $splitPos);
$headerValue = substr($rawHeader, $splitPos+1);
$headers[$headerKey] = $headerValue;
}
$content = substr($data, $meta['header_size']);
if ($meta['http_code'] == 301) {
preg_match('/Location: (.*)/', $content, $matches);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment