Jump to content

Help again


paparts

Recommended Posts

I want to change the value of crawler connect.

i have an array of urls which is the $urlList (e.g. [0]=>yahoo.com [1]=>cnn.com)

on first loop I have yahoo and the //find Location:http:// part displays yahoo's contents

but after yahoo the other urls no longer displays. can I ask help on this tnx.

 

<?php
foreach($urlList as $index=>$url){
echo $index. "<==>" .$url. "<br />";
$conHandle = $crawler->crawlerConnect($url);
$headers = $crawler->fetchHeader($conHandle);

//find Location:http:// 
foreach($headers as $content=>$value){
    echo $content. '===>' .$value."<br />";
    $string_to_find = 'Location';
    if($result = strstr($value, $string_to_find)){
    if(preg_match('/http:/', $result)){
    #$daisy->insert_query($headers[$content]);
    $split_header = explode(" ",$headers[$content]);
    echo "$index => $url redirects to: <a href=\"$split_header[1]\">$split_header[1]</a><br />";
    }
    }
    }
}
?>

 

(edited by kenrbnsn to add


tags)

Link to comment
https://forums.phpfreaks.com/topic/110926-help-again/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.