I have a php code where i try to update the whois data on SQL. I was able to add the whois raw response to MySQL table. The problem arise when I try to update it. My code looks like this:
//function
function whois($site)
{
$domain = $site;
$servers = array(
".com" => "whois.internic.net",
);
if (!isset($servers[$ext])) {
return false;
}
$nic_server = $servers[$ext];
$output = '';
// connect to whois server:
if ($conn = fsockopen($nic_server, 43)) {
fwrite($conn, $domain."\r\n");
while (!feof($conn)) {
$output .= fgets($conn, 128);
}
fclose($conn);
} else {
return false;
}
return $output;
}
$site ="example.com";
$whoisinfo = whois($site);
//updating data
$conn->query("UPDATE tablename SET whois='$whoisinfo' WHERE site='$site'");
But the data is not updated on the SQL. But I can see that other data can be updated. but not the whois data. Can anyone tell me the reason?