Stripping unwanted output

Discussion in 'PHP' started by C a s p e r, Sep 2, 2008.

  1. #1
    I have this bit of code that I am using first I used the javascript code given by alexa then I added an bit of code from a wordpress plugin and here is what I have

    <p>
    <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=<?php $values = get_post_custom_values("link"); echo $values[0]; 
    
    ?>
    ></SCRIPT></p>
    Code (markup):
    Now the problem is its giving this as a result when ran

    <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=[COLOR="Red"]http://[/COLOR]www.mysite.com'></SCRIPT></p>
    Code (markup):

    What I cant seem to find out or know how to do is remove the http:// using a strip command.

    Does anyone know a way to get around this?





    I have it solved now created a new field in wordpress and called it url and added the url without the http:// and changed the 'link' to 'url' and works perfect
     
    C a s p e r, Sep 2, 2008 IP
  2. Steve136

    Steve136 Peon

    Messages:
    240
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,

    Try this:
    
    <p><SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=<?php $values = get_post_custom_values("link"); echo str_replace($values[0], "http://", ""); ?> ></SCRIPT></p>
    
    PHP:
    Regards,

    Steve
     
    Steve136, Sep 2, 2008 IP