I am trying to fetch headers of Multiple domains and using CakephpHttpSocket but somehow not getting required Results
here is my code to hit a http socket call
private function justinsert($url)
{
// {
$method='POST';
$Pages = new PagesController;
$data['Server']['link']=$url;
$results=$Pages->callAPI($method, $url,'');
$data['Server']['webservername']=$results->getHeader('server');
$headersdata=$results->headers;
debug($results);
if(isset($headersdata['X-Hostname']))
{
$data['Server']['php version name']=$headersdata['X-Powered-By'];
$data['Server']['X-Hostname']=$headersdata['X-Hostname'];
}
elseif(isset($headersdata['Location'])){
$data['Server']['php version name']=$headersdata['X-Powered-By'];
$data['Server']['X-Hostname']=$headersdata['Location'];
}
else{
$data['Server']['php version name']=$headersdata['X-Powered-By'];
$data['Server']['X-Hostname']=$headersdata['Last-Modified'];
}
$this->Server->create();
if($this->Server->save($data))
{
debug($data);
}
unset($data);
unset($results);
// }
}
and here is the code for Final hit to Http Socket
public function callAPI($method, $url, $data){
$HttpSocket = new HttpSocket();
$data = json_encode($data);
$request = array(
'header' => array('Content-Type' => 'application/json',
),
);
$results = $HttpSocket->post($url, $data,$request);
return $results;
}
issue is that i am getting same header for almost all calls. Is there is some issue with my call or http Socket connection makes some cache and fetching same results for all calls