// $body = mb_convert_encoding ($response['body'],"utf-8","Shift_JIS"); $body = $response['body']; } $pos = 10000; $table = ""; // mb_substr($body,$pos,$pos2-$pos); $pos = mb_strpos($body,$from,$pos); if ($pos === false) { return($table.$body); } $pos2 = mb_strpos($body,$to,$pos+30); if ($pos2 === false) print "<br>strpos2がfalseを返しました。<br>"; if (substr($ton,0,1)=="+") { $pos2 += mb_strlen($to); if (strlen($ton)>1) $pos2 += substr($ton,1); } else $pos2 += $ton; $body1 = mb_substr($body,$pos,$pos2-$pos); if ($url=="") return ($body1); return (div_cut($body1)); } function div_cut($str) { global $time; if ($str=="") return ""; $pos = strpos($str,'<article>',0); if ($pos === false) return ""; $pos2 = strpos($str,'<div class="outer">',$pos); if ($pos2 === false) return $str; $pos3 = strpos($str,'</h1>',$pos2); $time1 = substr($str,$pos3+24,19); if (strcmp($time,$time1)<0) $time = $time1; return str_replace("<a href=","<a target='_NEW' href=",substr($str,$pos,$pos2-$pos))." ". substr($str,$pos2+36,$pos3-$pos2-36)."</a></article>".div_cut(substr($str,$pos3)); // <div class="outer"><dl><dt><div><h1>