$10 Paypal for 1st working answer- Need Regex & PHP help

Discussion in 'Programming' started by andheresjohnny, May 30, 2009.

  1. #1
    Hello,

    I am in immediate need of PHP code that will use regex to parse a string, recognize a hyperlink, and then replace the URL within that hyperlink with a different URL.


    Example

    String = "<p>Unfortunately, you can't make $20,000 monthly stuffing envelopes...if only it were that easy. But, you can make <strong>$50,000 a month</strong> running your own personal internet business <em>and</em> start earning money in less than an hour. <a target="_new" href="http://www.ohwhatascam.info">Click here to discover how</a>.</p>"


    In the above string I have underlined the hyperlink. I would want the URL in the hyperlink (http://www.ohwhatascam.info) changed to (http://www.my-secret-corner.com).

    The regex should be able to recognize ANY URL following the "href=" and replace it with "http://www.my-secret-corner.com". This includes COM/NET/ORG/INFO/Etc.

    So basically, I'm looking to change ALL URLs to a specific URL.


    I will pay $10 via Paypal to the first person who can give me a working solution.

    Thank you!
     
    andheresjohnny, May 30, 2009 IP
  2. Nooz2

    Nooz2 Peon

    Messages:
    445
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Done !
    Please check your PM.
    Thanks
     
    Nooz2, May 30, 2009 IP
  3. andheresjohnny

    andheresjohnny Well-Known Member

    Messages:
    964
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    120
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #3
    Thanks for the working solution.

    I sent $10 your way.
     
    andheresjohnny, May 31, 2009 IP
  4. Nooz2

    Nooz2 Peon

    Messages:
    445
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Nooz2, May 31, 2009 IP