file-put-contents

create php cache with file_get_contents

可紊 提交于 2019-12-10 12:04:37
问题 I am trying to create a cache file from a menu that takes random data called 'includes/menu.php' the random data is created when I run that file manually, it works. Now I want to cache this data into a file for a certain amount of time and then recache it. I am running into 2 problems, from my code cache is created, but it caches the full php page, it does not cache the result, only the code without executing it. What am I doing wrong ? Here is what I have until now : <?php $cache_file =

file_put_contents overwrites data

六眼飞鱼酱① 提交于 2019-12-02 11:25:11
I use file_put_content to write data in file every time there is an entry in database. Instead of appending new entry it overwrites old data with new.Here is part of code which I am using.I tried with APPEND In flag but doesn't work. ` include_once(CLASS_PATH."fetch_service.php"); $objfetch = new fetchService(); $res = $objfetch->fetch_proxy("*","where account_id='".$_SESSION['account_id']."'"); foreach($res as $result) { $proxyname=$result['proxyname']; $ip=$result['proxyip']; $proxyport=$result['port']; $proxyuser=$result['username']; $proxypwd=$result['password']; $proxydomain=$result[

How can I load a remote file using file_get_contents()?

有些话、适合烂在心里 提交于 2019-12-02 06:50:45
问题 Scratching my head a bit now with this. I am trying to get a file from a remote url. I can save contents from local files, but can't from remote. This works: file_put_contents( 'file1.xml', file_get_contents('file2.xml') ); This doesn't: file_put_contents( 'file1.xml', file_get_contents('http://www.domain.com/xmlapi/search.aspx?query=places&lid=38') ); Oddly enough my other scripts worked ok at first try but none will access the remote url now. I have recently started to host my new php files