Web Design and Programming Pt 12

[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


Posted

in

by

Tags:

Comments

24 responses to “Web Design and Programming Pt 12”

  1. marcus whelan Avatar

    How would you read an excel file for someone to download on a button?

  2. Peteman12 Avatar

    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.

  3. alexander shekhtman Avatar

    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!

  4. Shaun Go Avatar

    Great video. You have a highly unique ability to convey programming concepts in a clear and concise way. Thank you.

  5. SilverishKitten Avatar

    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 🙂

  6. Derek Banas Avatar

    I do my best to always help 🙂

  7. Kumesh Aroomoogan Avatar

    Got it. Thanks for the quick reply!

  8. Derek Banas Avatar

    You're very welcome 🙂 Here are a few solutions for you stackoverflow. com/questions/2352153/search-for-phrase-word-in-text-files-with-php

  9. Kumesh Aroomoogan Avatar

    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?

  10. aleko rubin Avatar

    I bet you forgot to close the file at the end…

  11. Derek Banas Avatar

    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

  12. Derek Banas Avatar

    What errors are you getting

  13. Derek Banas Avatar

    Thank you 🙂 I plan on covering PHP frameworks soon. I wish I wouldn't have skipped them in the past

  14. B4nks Avatar

    definitely a geat vid! Covers some built in funcs thst you dont see much of anywhere else on youtube!

  15. Derek Banas Avatar

    Do this $faqs = ''; to initialize it before calling the line in question. That should fix it

  16. StateRoad84 Avatar

    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.

  17. Derek Banas Avatar

    I found the code. What error are you getting exactly? I'll do my best to help

  18. Derek Banas Avatar

    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

  19. StateRoad84 Avatar

    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.

  20. Derek Banas Avatar

    You're very welcome 🙂 I'm just happy that you find them useful

  21. TheCrookHook Avatar

    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.

  22. Derek Banas Avatar

    I'm very glad to help 🙂

  23. Gilbert Bigelow Avatar

    So, any how, I took a break and came back to watch your video and the first thing, Bam, clarification. Thanks.

  24. Derek Banas Avatar

    @kingbill404 Thank you 🙂 As you can see, not many people made it as far as you did in this tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *