Hello. There is a php script that parses the sites. For the script to work, it needs a mini file key / value db. That is something like this:
blablabla.txt / ini / php / also:

blallallallal:blalallalallalal2222 kkkkkkkk:kdadlask22 lll32139:dkllkalkdla cache: ldkalkdlkd<br />tle;lt;<br />kldkasldkiuqiw41<br />и тыры пыры 

There are no ideas. I think that ini will not work, because there will be very, very long lines ... and even if it is, then I have no idea how to implement it. In the Internet I did not find. Thank you in advance.

  • Since when did the ini file become "mini file key / value db"? And not a file database is what? What specifically can you not implement? The script that you downloaded has a description for use. - ArchDemon
  • What json does not suit you? - naym pm
  • And maybe BerkeleyDB. Or even Redis, or in general sqlite ... Are there any options for the car, at least some criteria other than "file" and "key-value"? - user6550
  • ArchDemon, Why "downloaded"? I did the script, but I myself am a java programmer, just acquaintances asked .. I have no idea what methods you have here. naym, Yes please, only, again, I have no idea how to insert it in php. klopp; I do not need a huge database on 100+ fields, but only 5-10 fields and no more. I do not want to use any databases for such purposes. Guys, you probably did not understand - temporary information will be stored in this file, and change from time to time (about once every 5 minutes) .. I don't need a database for users or something like that, just temporary files. - Alex Wells
  • You take the data, put it into an array, encode the array in json, write json to a file. Then, respectively, you read the file, razzhasonivat, get the data, process, zhayshonivaet, write to the file. - MrClon

1 answer 1

As for json, it is done like this:

 $fileData = file_get_contents($pathToFile); $decoded = $fileData ? json_decode($fileData, true) : []; if(!empty($decoded['somekey']) && $decoded['somekey'] == 'blablabla') { $decoded['anotherkey'] = 'qwerty'; } file_put_contents($pathToFile, json_encode($decoded)); 

http://php.net/manual/ru/function.json-decode.php
http://php.net/manual/ru/function.json-encode.php
http://php.net/manual/ru/function.file-get-contents.php

  • Thank you and you =) - Alex Wells