user518138
user518138

Reputation: 251

How to read this php code?

How to decode this string in php?

$x = "h\164tp\163\072\057\057\x70r\157\x64\x75\x63t-\x73\x65a\x72\143\150\056\x61\160i\x2e\x63\x6a\x2ec\x6f\x6d\057v\062/\160\x72\157\x64\165\x63t\x2ds\x65\141\162\143\x68\x3f";

It looks like a regex URL, but how to read what it is?

Thanks.

Upvotes: 3

Views: 555

Answers (6)

jnbdz
jnbdz

Reputation: 4383

Simple:

utf8_decode();

http://www.php.net/manual/en/function.utf8-decode.php

Upvotes: 0

Spudley
Spudley

Reputation: 168715

Well, I created a PHP page as follows:

<?php
$x = "h\164tp\163\072\057\057\x70r\157\x64\x75\x63t-\x73\x65a\x72\143\150\056\x61\160i\x2e\x63\x6a\x2ec\x6f\x6d\057v\062/\160\x72\157\x64\165\x63t\x2ds\x65\141\162\143\x68\x3f";

print $x;
?>

and ran it.

And I got the following:

https://product-search.api.cj.com/v2/product-search?

Which means nothing to me, except that cj.com is part of Commission Junction, which is an online advertising network.

It's been deliberately obfuscated, so clearly the person who wrote it intended that you didn't notice it or understand it, and would leave it alone. I don't know the context of the question, why you're asking about it, but my guess would be that you've been hacked and someone has inserted this code (and more) into your site.

If that's the case, their aim would clearly be to gain some advertising revenue by freeloading on your site. Not particularly malicious as hacks go, but not something you'd want to be happening (especially if you don't know what kind of ads would be shown).

Upvotes: 0

Adithya Surampudi
Adithya Surampudi

Reputation: 4454

just print it, its a url

https://product-search.api.cj.com/v2/product-search?

Upvotes: 0

johnsyweb
johnsyweb

Reputation: 141840

Print it!

% cat test.php 
#!/usr/bin/env php

<?php
$x = "h\164tp\163\072\057\057\x70r\157\x64\x75\x63t-\x73\x65a\x72\143\150\056\x61\160i\x2e\x63\x6a\x2ec\x6f\x6d\057v\062/\160\x72\157\x64\165\x63t\x2ds\x65\141\162\143\x68\x3f";
print $x;
?>

% ./test.php
https://product-search.api.cj.com/v2/product-search?

Upvotes: 3

Gidon Wise
Gidon Wise

Reputation: 1916

just echo it out.

<?
$x = "h\164tp\163\072\057\057\x70r\157\x64\x75\x63t-\x73\x65a\x72\143\150\056\x61\160i\x2e\x63\x6a\x2ec\x6f\x6d\057v\062/\160\x72\157\x64\165\x63t\x2ds\x65\141\162\143\x68\x3f";
echo $x;

It outputs:

https://product-search.api.cj.com/v2/product-search?

Upvotes: 8

Jakub L&#233;dl
Jakub L&#233;dl

Reputation: 1805

It is actually a string with some characters specified in hexadecimal and octal notation. Just echo it.

Upvotes: 1

Related Questions