Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Thanked 0 Times in 0 Posts

    Small Str_Replace Problem

    I am trying to send a URL to a webpage like the following:

    This I have got working fine but when there are additional variables in the second URL this is when problems occur, E.g.

    So Instead of doing it like this (I am the original person that sends the URL data in the URL) I have changed it so that I search and replace all &'s with ;'s before it is sent with the following:

    $url = $subfetch['link'];
    $url = str_replace("&",";",$url);
    header ("location:".$url);

    But for some reason it is not replacing the & symbols. I can see in my browser that the next page says:

    Instead of replacing the &'s with ;'s.

    Can anyone see what I am doing wrong here or know of an alternative way to obtain a URL from a URL like this?

  2. #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    In a place far, far away...
    Thanked 1,043 Times in 1,019 Posts
    You are going about this the wrong way. I suggest that you use urlencode to encode the url so the url query string goes through fine then whatever site you need to get the url variable from just use urldecode.

  3. Users who have thanked _Aerospace_Eng_ for this post:

    Sussex_Chris (01-07-2010)


Posting Permissions

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