SA-MP Forums Archive
Php help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Php help (/showthread.php?tid=229677)



Php help - Robert_Crawford - 22.02.2011

<?php
global $config;
$local_file = "dmap_feed.json";
$server_file = "/scriptfiles/dmap_feed.json";

$ftp_server = "173.224.220.104"; // Address of FTP server.
$ftp_user_name = "******"; // Username
$ftp_user_pass = "*******"; // Password
#$destination_file = "/scriptfiles";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
"File Downloaded $local_file\n";
} else {
"Desculpe.Servidor Esta Desligado\n";
}
$config['api key']='ABQIAAAAs4hWYZkFgUCmji8OXGEWhRSksbxBFPegAttWA_e4 E3REnVZ2ahTH-L1GBwSzV3-OuBv0_8-shNpqtQ';
$config['default script'] = 'dmap_feed.json';
$config['allow external'] = true;

?>



and the map is not showing pepole, so im not sure, you see anything wrong?

--------------Error Code Found
[21-Feb-2011 23:03:47] PHP Warning: file_get_contents(/vrp-gta.com/servermap/dmap_feed.json) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home/robert40/vrp-gta.com/servermap/fetch_data.php on line 19


Re: Php help - JaTochNietDan - 22.02.2011

It means it couldn't find the file. Try adding a . to the start of the directory, like so:

PHP код:
$server_file "./scriptfiles/dmap_feed.json"
This makes sure you're working from the current directory.

Also the error is from a different script, since it's about file_get_contents. This appears to be fixable if you specify the full path in the file_get_contents function, like so:

PHP код:
file_get_contents("/home/robert40/vrp-gta.com/servermap/dmap_feed.json");