Ah! Found the problem... It is probably a bug with strpos() because it
seem to get stuck in there and couldn't get out of it somehow. The
workaround the problem I did was just easily increment the $HTML_End by 1
and that fixed the problem. It look like this...
--snip--
$XML_Start = (strpos($res_str,"<![CDATA[")+9);
$HTML_Start = (strpos($res_str,"<![CDATA[",$XML_Start)+9);
$HTML_End = strpos($res_str,"]]>",$HTML_Start);
$HTML_End += 1;
$XML_End = strpos($res_str,"]]>",$HTML_End);
--snip--
Thanks all for the quick feedback! I appreciate it!
Scott F.
"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Um, it seem to work. That's weird. Should have check for the string
length
> first, so I wasn't looking at the same problem. So, I did further
debugging
> and I'm going to post the script here. Still don't know what is the
problem
> here...
>
> --snip--
> $XML_Start = (strpos($res_str,"<![CDATA[")+9);
> $HTML_Start = (strpos($res_str,"<![CDATA[",$XML_Start)+9);
> $HTML_End = strpos($res_str,"]]>",$HTML_Start);
> $XML_End = strpos($res_str,"]]>",$HTML_End);
>
> echo $XML_Start." ***XML Start<br>";
> echo $XML_End." ***XML End<br><br>";
> echo $HTML_Start." ***HTML Start<br>";
> echo $HTML_End." ***HTML End<br>";
>
> echo strlen($res_str);
> --snip--
>
> The response I got here is...
>
> --snip--
> 319 ***XML Start
> 119843 ***XML End
>
> 25650 ***HTML Start
> 119843 ***HTML End
> 120015
> --snip--
>
> As we see, the number for $XML_End and $HTML_End are the same which is
> not correct because there are two seperate "]]>" near the end of hte
string.
> So, I still don't know what hte problem is...
>
> Scott F.
>
> "Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > * Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
> > > strpos() is acting a little bit funny. When I do this...
> > >
> > > --snip--
> > > $a = strpos($data,"]]>");
> > > --snip--
> > >
> > > Problem is there are "]]>" characters in the $data string and it just
> > > doesn't see it. Anyone know why and what is the workaround to it?
> >
> > It works perfectly fine:
> >
> > $data = 'asdf ]]> asdf';
> > $a = strpos($data,"]]>");
> > print $a; //output: 5
> >
> >
> > Curt
> > --
> > "My PHP key is worn out"
> >
> > PHP List stats since 1997:
> > http://zirzow.dyndns.org/html/mlists/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php