Ho risolto, era una cavolata. Se a qualcuno interessa questo è il codice:
Codice PHP:
function StringBetween($str, $sx, $dx) {
$pos_sx = strpos($str, $sx);
$len_sx = strlen($sx);
$pos_be = $pos_sx + $len_sx;
$pos_dx = strpos($str, $dx);
$len_be = $pos_dx - $pos_be;
return substr($str, $pos_be, $len_be);
}