Closed Thread Icon

Topic awaiting preservation: Str_replace in PHP Pages that link to <a href="https://ozoneasylum.com/backlink?for=12874" title="Pages that link to Topic awaiting preservation: Str_replace in PHP" rel="nofollow" >Topic awaiting preservation: Str_replace in PHP\

 
Author Thread
Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-29-2003 23:58

Hye guys...I'm having a bit of a problem with doing a str_replace() in a script I'm wokring on right now. Say I had a string, formatted kinda like a google search, say... +"Ozone Asylum" -somethingleet. In order to build a URL out of that that google will read it has to look like this:

%2B%22Ozone+Asylum%22+-somethingleet

Now, I can get a str_replace() to replace the + with %2B just fine, but I can't get it to replace a whitespace with + or a " with %22...is this actually possible in str_replace? Or do I have to go to something a bit more complex?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-30-2003 00:13

urlencode()


Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-30-2003 00:32

Thanks for that Max...although urlencode() doesn't seem to replace it with the correct entites, for example it replaces " with %26quot, which is most definatley not the correct entity for the url...hmmmmm...

Couple with the fact that I can't get the regex which captures the original string refuses to capture whitespace...it just ends at a whitespace.



[This message has been edited by Skaarjj (edited 08-31-2003).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-30-2003 16:22

how about rawurlencode()?

« BackwardsOnwards »

Show Forum Drop Down Menu