NYCPHP Meetup

[nycphp-talk] Converting hex?

Jeff Loiselle jeff.loiselle at gmail.com
Wed Sep 6 10:34:53 EDT 2006


Rob,

I ended up doing this:

$response = str_replace('\x', '%', $response);
$response = urldecode($response);

That did the trick. :-)
/jeff

On 9/5/06, Rob Marscher <rmarscher at beaffinitive.com> wrote:
> Did you figure this one out?
>
> Try
>
> $data - file_get_contents($some_remote_https_url);
> $pieces = explode(',', data);
> print preg_replace("/(\\\x[0-9A-Fa-f]{1,2})/e", "chr(hexdec('\\1'))", $pieces[0]);
>
> Seems to do the trick.
> -Rob
>
> Jeff Loiselle wrote:
> > Anyone know of a nice efficient function to convert this?
> > $name = 'Tony D\x27Antonio';
> >
> > I realize that putting it in double quote will do it, but I am unable
> > to do that. As I am doing something like this:
> >
> > $data - file_get_contents($some_remote_https_url);
> > $pieces = explode(',', data);
> > print $pieces[0];
> >
> > Output:
> > Tony D\x27Antonio
> >
> > This doesn't seem to help:
> > print "$pieces[0]";
> >
> > I'm looking for the most efficient way, as this is being used in a
> > REST response parser. Thanks!
> >
> > ---
> > Jeff Loiselle
> > Web Developer
> > The NewNewMedia Group
> > http://www.newnewmedia.com
> > _______________________________________________
> > New York PHP Community Talk Mailing List
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
> > NYPHPCon 2006 Presentations Online
> > http://www.nyphpcon.com
> >
> > Show Your Participation in New York PHP
> > http://www.nyphp.org/show_participation.php
> >
> >
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>


-- 
---
Jeff Loiselle
Web Developer
The NewNewMedia Group
http://www.newnewmedia.com



More information about the talk mailing list