[ad_1]
Here I show you how to manipulate files with PHP. Read file into an array : Read file into a string : Grab text off of web pages : Strip HTML tags : Write to files
Code is here
[ad_1]
Here I show you how to manipulate files with PHP. Read file into an array : Read file into a string : Grab text off of web pages : Strip HTML tags : Write to files
Code is here
by
Tags:
How would you read an excel file for someone to download on a button?
One thing I like to do in PHP is define a constant "br" at the beginning so I don't have to quote it over and over again.
can you write to a file directly as you pull stuff off of a website, instead of doing this first, closing it and then opening another file and writing one to the other? also, how do modify permissions in the code, have the file/dir be writable and locked just for that process and then change permissions when closed and then lock again. it seems dangerous to have a file/dir open for everyone!
Great video. You have a highly unique ability to convey programming concepts in a clear and concise way. Thank you.
Hi, I don't know if it's because php has changed since this video was made, or if setup is just different. But like other people I get "undefined variable" errors at the last bit of of video where you put in "$faq .=". This happens with your code as well … I googled around and apparently you have to initialize it first by doing this: $faq = "";
After i initialized the variable, everything was working as it should. Maybe this will help someone 🙂
I do my best to always help 🙂
Got it. Thanks for the quick reply!
You're very welcome 🙂 Here are a few solutions for you stackoverflow. com/questions/2352153/search-for-phrase-word-in-text-files-with-php
Hey Derek,
Thanks for all the videos it helps a lot. I do have a question based on extracting keywords from multiple articles. What I want to do is be able to pull out all of the positive and negative words from the articles after I have scrape the articles from the web. How would I go about doing that?
I bet you forgot to close the file at the end…
Maybe there is a permissions problem? This is very common with windows. Make sure you have permission to write in the folder you are using with your web server
What errors are you getting
Thank you 🙂 I plan on covering PHP frameworks soon. I wish I wouldn't have skipped them in the past
definitely a geat vid! Covers some built in funcs thst you dont see much of anywhere else on youtube!
Do this $faqs = ''; to initialize it before calling the line in question. That should fix it
Notice: Undefined variable: faqs in /Users/thomvon/Sites/NTT-Tutorials/php/FileIO/fileIO.php on line 14. Line 14 refers to that line of code.
The code does create the "justthefaqs.txt" file and writes to it, so it does all it is supposed to do. But it throws that error. I am using php 5.3.15.
I found the code. What error are you getting exactly? I'll do my best to help
Thank you very much 🙂 I'm a bit confused though. I get a ton of comments and I'm not sure what comment you are referring to from Lucas. I'm also wondering where you got the code $faqs .= fgetss($file_2, 1024); from
Hello Derek,
You are without a doubt the best teacher on youtube.
In response to what Lucas said I too get the Undefined variable error. The difference is that I followed your suggestion to set up a MAMP stack using the Apple system installed software. I get very few glitches this way (great advice) and am always able to fix them. This is a head scratcher. Is it possible a setting in the .ini or .conf files? Has to do with $faqs .= fgetss($file_2, 1024); var definition.
You're very welcome 🙂 I'm just happy that you find them useful
MySQL tutorial coming up soon Derek 😉 Can't wait to see it … But I'm watching all these first. Thanks a lot man, you're helping me out immensly.
I'm very glad to help 🙂
So, any how, I took a break and came back to watch your video and the first thing, Bam, clarification. Thanks.
@kingbill404 Thank you 🙂 As you can see, not many people made it as far as you did in this tutorial
Leave a Reply