Hi guys i need a guid on read txt file i have a file named mw2.log
and this file have mutiple line and per line i have ip:port
like as:
1.1.1.1:222
2.2.2.2:3333
3.3.3.3:888
....
with this method i can read file but i want to put every line in array and seprat ip and port and return with $ip
and $port
result because i want to send ip's and port's throw POST method to other file named add.php
my code is:
<?php
$file = "mw2.log";
$source_file = fopen( $file, "r" ) or die("Couldn't open $file");
if (!feof($source_file)) {
$buffer = fread($source_file, 4096); // use a buffer of 4KB
//some stuff here
fclose($source_file);
} else {
// error opening the file.
}
//$form_type = 'callofduty4';
//$form_ip = '37.187.71.163';
//$form_c_port = '16044';
$Curl_Session = curl_init('http://127.0.0.1/serverlist/lgsl_files/robot.php');
curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "form_type=$form_type&form_ip=$form_ip&form_c_port=$form_c_port");
curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_exec ($Curl_Session);
curl_close ($Curl_Session);
?>