من داخل رشته جستجو مي كنم .
//بدست آوردن و بريدن بخش ابتدايي ...
$st2=substr($st2,strpos('<table id="tbwork">'));
در اينجا '<table id="tbwork"' را پيدا كردم و با تابع substr رشته را بريدم . يعني از ابتداي رشته تا محل برگردانده شده توسط تابع strpos را دور انداختم .
// جدا سازي بخش انتهايي ....
$st2=substr($st2,0,strpos($st2,'</table>'));
در اينجا هم همان عمليات اتفاق مي افته ؛ فقط يك فرق كوچك داره كه من از ابتداي رشته يعني موقعيت 0 تا محل انتهاي رشته مورد نظر را جدا مي كنم و نگه مي دارم .
توضيحات substr و strpos
strpos
(PHP 4, PHP 5)
strpos — Find position of first occurrence of a string
Description
int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
Returns the numeric position of the first occurrence of needle in the haystack string. Unlike the strrpos() before PHP 5, this function can take a full string as the needle parameter and the entire string will be used.
------------
SubStr
string substr ( string $string , int $start [, int $length ] )
Returns the portion of string specified by the start and length parameters.
موفق باشيد .