DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: php? program on webhost needed  (Read 8,722 times)

IdiotSavant

  • Participant
  • Joined in 2012
  • *
  • Posts: 4
IDEA: php? program on webhost needed
« on: May 22, 2012, 02:18 AM »
I have a large website (over 5k pages in many directories) that I need to change the phone number in each page.  I don't know how easy or hard it would be to code something to run on the webserver that would find and replace a string of text.
Any attempts will be appreciated.
IdiotSavant

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: IDEA: php? program on webhost needed
« Reply #1 on: May 22, 2012, 02:43 AM »
You could look at <ahem> FART (that's Find And Replace Text).

Or, similarly, GSAR (General Search And Replace) would do it.

I have used both in several batch processes.
vi vi vi - editor of the beast

IdiotSavant

  • Participant
  • Joined in 2012
  • *
  • Posts: 4
Re: IDEA: php? program on webhost needed
« Reply #2 on: May 22, 2012, 02:53 AM »
Thanks, I'll check them both out.
IS

IdiotSavant

  • Participant
  • Joined in 2012
  • *
  • Posts: 4
Re: IDEA: php? program on webhost needed
« Reply #3 on: May 22, 2012, 03:02 AM »
It looks to me like these both are windoze.  My webhost account is a linux account. Guess I should have made that clear.
Thanks though
IS

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: IDEA: php? program on webhost needed
« Reply #4 on: May 22, 2012, 03:25 AM »
I'm sure there is some existing php code to do search+replace over multiple files, BUT if someone wants to make a new tool that does this, I have written some php classes and code that should make the job much easier, in my (open source) mwimporter package.  Again, it does *not* do search and replace, but it will nicely iterate through recursive directories of files and do a few more helpful things that could be used as a starting point.
« Last Edit: May 22, 2012, 12:15 PM by mouser »

IdiotSavant

  • Participant
  • Joined in 2012
  • *
  • Posts: 4
Re: IDEA: php? program on webhost needed
« Reply #5 on: May 22, 2012, 11:42 AM »
:Thmbsup: After looking at your package, I thought about my situation again and realized I already have a sitemap I could operate on so now I just need to find something that will take that and search/replace over the files.  I'll look for it.
IS

Original address: https://www.donationcoder.com/forum/index.php?topic=31084.0