I have a file called priv.txt. In it reads:
9992,"D7Mc8DJUsN4xisbVRKDfNVYxspVXQ776EG","6JQ5cdFBBax7GBmBuK8j2vvBcNUAYJjvzBQzMMfen26SwpCsNxh"
9993,"DEbh8BmvCHqJgX6YFMjbqgewHHQKo4PJWT","6JTwvRVVTTit1PZRpKQDSCeFPG2knWmDAN7uRgeY2o58pUD8sRf"
9994,"DMJ5LhU7XBtZvmNHswthR5tnFR71FFDxFn","6JMr4n8xK3NCdjyMBrqPWCvPpbifjr6ofPi1jha79FYzPSgBTWf"
etc...
What I need to do, is output (via echo for example) in this format:
'{"D7Mc8DJUsN4xisbVRKDfNVYxspVXQ776EG":2,"DEbh8BmvCHqJgX6YFMjbqgewHHQKo4PJWT":2,"DMJ5LhU7XBtZvmNHswthR5tnFR71FFDxFn":2}'
The 2 should always stay the same and this only concerns the first column, the second column with strings beginning with "6" is irrelevant.
I have a php file which does:
<?php
$fh = fopen('priv.txt','r');
while ($line = fgets($fh)) {
// <... Do your work with the file ...>
echo($line);
}
fclose($fh);
?>
This just outputs the entire content of priv.txt.
Can anyone help?