Search the Community
Showing results for tags 'file_put_contents'.
-
Hi When I have a file that echoes some stuff and I press view source and copy paste the source and manually makes this to a .txt file Something different happening somewhere comapred to if I have ob_start() //before the content ob_get_contents and file_put_contents //after to make the text file. I' do get a text file. It looks the same. the content is the same as my manually made. But when I load it with ajax in to my div only the manually made is scrollable. the scroll is made with .js What is going on here?
- 4 replies
-
- file_put_contents
- ob_get_contents
-
(and 1 more)
Tagged with:
-
Hello I have problem to get the whole loop saved in to a file. I seams to save only the last "section" So I have two json files that I decode and managed to echo as I wanted. Now plans changed and I want to save what was echoed in to a file instead. I planned to use file_put_contents for that. My code looks like this but it did not put the whole list in to the file. just one. (I show you only the foreach and attempted file saving. <code> foreach ( $venues as $item){ $s1 = '<li style="padding-top:15px;">' . '<a target="_blank" href="http://foursquare.com/v/' . $item['id'] . '">' . $item['name'] . '</a></li>'; $endpoint2 = 'venues/' . $item['id'] . '/tips'; $params2 = '?limit=1'; $url2 = $base_url.$endpoint2.$params2.$auth; $results2 = file_get_contents($url2); $json_results2 = json_decode($results2,true); $venues2 = $json_results2['response']['tips']['items']; foreach ( $venues2 as $ti){ $s2 = '<li>' . '<span>' . date('j.n.Y',$ti['createdAt']) . '</span>' . ' - ' . $ti['text'] . '</li>'; } } file_put_contents('output.txt',$s1 . $s2); //echo $s1 . $s2; //for quick check </code> If I remove the $s1 and respectively $s2 and put the echo instead I get the whole result on my screen. So why is this only taking the last <li><a href="url and result and so on in to the file? This forum did not allow me to format my text, so appologises for that.
-
I'm just trying to load some of the echoed results in to a txt file that I can use myself. I assumed that there should be a txt file in my server directory but no file has been created. What am I doing wrong? while ($blekr<=$blekko_count) { echo '<a href='.$Blekko[$blekr]['url'].'><h4>'.$Blekko[$blekr]['url_title'].'</h4></a>'; echo '<p>'.$Blekko[$blekr]['snippet'].'<p>'; echo '<b>'.$Blekko[$blekr]['engine'].'</b>'; $file = 'Blekko.txt'; file_put_contents($file, $Blekko[$blekr]['url'], FILE_APPEND); echo '<hr>'; $blekr++; } The echo statements run fine but no file anywhere to be found. There isn't anything said in the manual either ...
- 3 replies
-
- file_put_contents
- txt
-
(and 1 more)
Tagged with: