Hello, I'm trying to read a text file which is on the web and then insert its contents in a database using PHP. I think my code is okay but I keep getting this error message which I think might be permission problems so I just need clarity on this. Here's my code.
$mysqlserver = "localhost";
$mysqllogin = "root";
$mysqlpassword = "";
$mysqldb = "ports";
$conn = mysql_connect("$mysqlserver", "$mysqllogin", "$mysqlpassword");
if (!$conn)
{
die('Could Not Connect To The MySQL Database<hr />' . mysql_error());
}
mysql_select_db("$mysqldb", $conn);
$url = 'http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt';
$feed = fopen($url, "r")
or die("Could Not Open The TEXT File<hr /> " . mysql_error());
$file = file_get_contents($url,true);
and here is the error I keep getting.
Warning: fopen(http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt) [function.fopen]: failed to open stream: No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\csv.php on line 7
Could Not Open The TEXT File
and line 7 is this code
$feed = fopen($url, "r")
thanks in advance your help will be highly appreciated.