Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

IDR

[Resolvido] Problemas para pegar numero em .txt

Recommended Posts

Buenas!

Estou com um sistema que recebe logs de Texto como o mostrado abaixo e gostaria de pegar o numero destacado em vermelho.

 

 

 

[2000/03/01 00:53:00]

Flight IATA:AD4011

Pilot Number:002

Company ICAO:AZU

Aircraft Type:E190/M

PAX:80

Aircraft Registration:PR-AZL

Departing Airport: SBKP

Destination Airport: SBPA

Alternate Airport:SBFL

Online: VATSIM

Route:CPN PREGO UA310 CTB UW24

Flight Level:FL360

No Slew and time accel

00:53 Zero fuel Weight: 38511 Kg, Fuel Weight: 5393 Kg

01:03 Parking Brakes off

01:03 Com1 Freq=135.75

01:16 VR= 153 Knots

01:16 V2= 158 Knots

01:16 Take-off

01:16 Take off Weight: 43454 Kg

01:16 Wind: 137? @ 010 Knots Heading: 126?

01:16 POS S23? 00? 39?? W047? 07? 46??

01:16 N11 90 N12 90

01:16 Flaps:2 at 159 Knots

01:16 Gear Up: 160 Knots

01:18 Flaps:1 at 212 Knots

01:20 Flaps:Up at 228 Knots

01:27 Com1 Freq=123.45

01:31 Wind:128?@013 Knots Heading: 216? Ground Speed: 430 Knots Altitude 27933 ft

01:38 TOC

01:38 Fuel Weight: 3878 Kg

01:46 Wind:119?@012 Knots Heading: 217? Ground Speed: 361 Knots Altitude 36187 ft

02:01 Wind:076?@017 Knots Heading: 197? Ground Speed: 468 Knots Altitude 36072 ft

02:11 TOD

02:11 Fuel Weight: 3146 Kg

02:16 Wind:048?@019 Knots Heading: 206? Ground Speed: 463 Knots Altitude 34845 ft

02:31 Wind:052?@006 Knots Heading: 104? Ground Speed: 236 Knots Altitude 708 ft

02:32 Gear Down: 217 Knots

02:32 Flaps:1 at 203 Knots

02:33 Flaps:Full at 170 Knots

02:33 Flaps:5 at 169 Knots

02:33 Flaps:Full at 163 Knots

23:49 Com1 Freq=124.85

23:49 UTC Jump: removed 1 Hour from Log

23:49 Gear Up: 000 Knots

06:50 TouchDown:Rate -349 ft/min Speed: 157 Knots

06:50 UTC Jump: added 1 Hour to Log

02:35 UTC Jump: added 1 Hour to Log

02:35 Gear Down: 00 Knots

02:35 Com1 Freq=122.80

02:35 Flaps:Up at 0 Knots

02:35 Flaps:Full at 0 Knots

02:35 Land

02:35 Wind:000?@000 Knots

02:35 Heading: 272?

02:35 Flight Duration: 02:19

02:35 Landing Weight: 43398 Kg

02:35 POS S29? 59? 42?? W051? 09? 38??

02:35 Parking brakes on

02:35 Block to Block Duration: 02:32

02:35 Final Fuel: 2684 Kg

02:35 Spent Fuel: 2709 Kg

02:35 Flight Length: 492 NM

02:35 TOD Land Length: 127 NM

 

 

 

 

Eu tenho o seguinte código:

 

function PegarTD($conteudo)
{
	return substr(strstr($conteudo,'TouchDown:Rate '),15,4);	

}

$td= PegarTD($conteudo);

Mas o sistema funciona apenas para alguns logs. A maioria não pega a informação.

 

Vale lembrar que o numero em questão MUDA de acordo com os logs!

 

Alguem saberia resolver ?

 

Atenciosamente,

IDR

Compartilhar este post


Link para o post
Compartilhar em outros sites

$txt = "
23:49 UTC Jump: removed 1 Hour from Log
23:49 Gear Up: 000 Knots
06:50 TouchDown:Rate -349 ft/min Speed: 157 Knots
06:50 UTC Jump: added 1 Hour to Log
02:35 UTC Jump: added 1 Hour to Log
";

preg_match( "/TouchDown:Rate (-?[0-9]+)/i", $txt, $matches );

echo $matches[1];

 

http://br2.php.net/preg_match

http://guia-er.sourceforge.net/

Compartilhar este post


Link para o post
Compartilhar em outros sites

Estava estudando aqui essas ER. São muito interessantes.

Vou estuda-las mais a fundo.

Muito obrigado Beraldo!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.