0

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

for your information i create the simple database in meta_tags.txt

Error message:

Warning: fopen() [function.fopen]: Couldn't resolve host name in /home/myweddin/public_html/allan/header.php on line 3

Warning: fopen(http://allan.myweddingmemory.com/meta_tags.txt) [function.fopen]: failed to open stream: operation failed in /home/myweddin/public_html/allan/header.php on line 3

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /home/myweddin/public_html/allan/header.php on line 7

header.php:

<?php
$database = 'http://allan.myweddingmemory.com/meta_tags.txt';
$meta_db = fopen($database, 'r');
$page = $_SERVER['SCRIPT_NAME'];
$page = substr($page, 1);

while($data = fgetcsv($meta_db, 9000, '|'))
{
    if($data[0] == $page)
    {
                $title = $data[1];
        $meta_keywords = $data[2];
        $meta_description = $data[3];
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php print $title; ?></title>
<meta content="index, follow" name="robots" />
Community
  • 1
  • 1
Muhammad Rusly
  • 73
  • 3
  • 16
  • Your first issue is that 'http://allan.myweddingmemory.com/meta_tags.txt' cannot be opened - either by your script or by me (I just entered the address into my browsers address bar and got told that allan.myweddingmemory.com could not be found). – mdm Mar 10 '11 at 09:50
  • check: http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen – usoban Mar 10 '11 at 09:51
  • here is the link http://allan.myweddingmemory.com/lasik/cataract/malaysia/vista/eye/specialist/reading/vistareadingfaq.php – Muhammad Rusly Mar 10 '11 at 09:52
  • "Couldn't resolve host name" isn't a programming problem. – Ignacio Vazquez-Abrams Mar 10 '11 at 09:52
  • second link does not work either. – mdm Mar 10 '11 at 09:54

2 Answers2

0
Warning: Couldn't resolve host name

That's your problem, right there. Your DNS resolver at the server is unable to resolve allan.myweddingmemory.com to an IP address, therefore can't connect to it, therefore can't send a HTTP request, therefore can't get a response, therefore can't read its data.

Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
0

ping your server allan.myweddingmemory.com and swap it out for the IP address if it returns one. If one is not returned, then you have a problem somewhere in communication with your server.

schuhmi2
  • 45
  • 7