Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2008
    Location
    UK
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Save Documents on MYSQL DB using PHP script

    Hello:

    Please I need help. I need to download URL and save the content into MYSQL database as word documents. I used to save the URL only because I didn't needed the content of the URL but now I reach a stage where I'll need to save the content of these URL in database and browse them one by one and analyse them this why i need to know how I can save them into 1 table with the URL as well.!! I have MYSQL background but I know how to save fields with limited length . how can I save files instead of limited length content????

    Hope I'll get answer as soon as possible

    Thanks,
    Last edited by PHP-Beginner; 03-09-2008 at 01:32 PM.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Use a TEXT/MEDIUMTEXT/LONGTEXT field. (manual)

  • #3
    New to the CF scene
    Join Date
    Mar 2008
    Location
    UK
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your reply.
    this will take huge amount of memory to save around 1000 URL content right!! is this the only way or will there be any alternative to save the content as Separate files and link them to the DB field?

    And could any one tell me the best way to get the content of the URL page to save them in the DB? I need the content as plain text, is there any function in PHP allow me to do that!!

    many thanks in advance

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    It won't take up large amounts of memory unless you're trying to retrieve several large ones at a time. But, you could store them in files, and reference the files in the database if you wanted to.
    file_put_contents() is the easiest way to save a file.

  • #5
    New to the CF scene
    Join Date
    Mar 2008
    Location
    UK
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much for your helpful replies Inigoesdr,

    I still need to know now how can I extract the content of the web pages as lain text and save them in the table.

    Many thanks

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    You can use file_get_contents() to get a webpage as long as your host supports url fopen wrappers(check your phpinfo).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •