0
I wanted to transform this code to Eval(), because it ta reading only the files like data.php html and php scripts not.
// arquivo cujo conteúdo será enviado ao cliente
$dataFileName = 'data.php';
while ( true )
{
$requestedTimestamp = isset ( $_GET [ 'timestamp' ] ) ? (int)$_GET [ 'timestamp' ] : null;
// o PHP faz cache de operações "stat" do filesystem. Por isso, devemos limpar esse cache
clearstatcache();
$modifiedAt = filemtime( $dataFileName );
if ( $requestedTimestamp == null || $modifiedAt > $requestedTimestamp )
{
$data = file_get_contents( $dataFileName );
$arrData = array(
'content' => $data,
'timestamp' => $modifiedAt
);
$json = json_encode( $arrData );
echo $json;
break;
}
else
{
sleep( 2 );
continue;
}
}
Can you explain better what you mean by
transformar esse código para eval()
?– Sergio
http://rberaldo.com.br/server-push-long-polling-php-ios/ Watch the last comment of this post you will understand me better
– Lucas C.S
The opening tag of this as <? Or <?php
– rray
The opening tag is <?php
– Lucas C.S
@Lucasc. S, from this . php you want to make a request to
data.php
is that your question? Try to make it clearer, for you it may seem obvious but for others it is not.– rray