How to call a PHP from another server using shell script? I have a PHP file and a shell script, the 2 files are stored in different server.
I have this Shell script:
#!/bin/bash
php "http://example.com/csv_import.php"
But when I run this command manually, I got an error: Could not open input
PHP:
if (($handle = fopen($directory_root."filename.csv", "r")) !== FALSE){
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){
$sql = "INSERT INTO tablename(col1,col2,col3,col4,col5)
VALUES ('".mysql_escape_string($data[0])."',
'".mysql_escape_string($data[1])."',
'".mysql_escape_string($data[2])."',
'".mysql_escape_string($data[3])."',
'".mysql_escape_string($data[4])."')";
$query = mysql_query($sql);
}
fclose($handle);
}