phey
Beginner 1.0
Adakah disini yang punya ide lebih bagus dan tepat untuk masalah ini, saya mau bikin script buat menyalin url ke dalam file xml, tapi page by page .. tujuan nya sih buat menghemat memory ..
My Code:
<?php
include('api.php');
$page = (int) $_GET['p'] ? (int) $_GET['p'] : 1;
$api = new getApi( array(
'filter' => 'new',
'page' => $page,
'limit' => 10
));
if ( $data = $api->getResult() ) {
$test = new XMLWriter();
$test->openURI(dirname(__FILE__) . '/test.xml');
$test->startDocument('1.0', 'UTF-8');
foreach($data as $datas) {
$test->startElement('url');
$test->text('http://localhost:8080/' . $datas['permalink']);
$test->endElement();
}
$test->endDocument();
} else {
echo "Error !!!!";
}
?>
My Code:
<?php
include('api.php');
$page = (int) $_GET['p'] ? (int) $_GET['p'] : 1;
$api = new getApi( array(
'filter' => 'new',
'page' => $page,
'limit' => 10
));
if ( $data = $api->getResult() ) {
$test = new XMLWriter();
$test->openURI(dirname(__FILE__) . '/test.xml');
$test->startDocument('1.0', 'UTF-8');
foreach($data as $datas) {
$test->startElement('url');
$test->text('http://localhost:8080/' . $datas['permalink']);
$test->endElement();
}
$test->endDocument();
} else {
echo "Error !!!!";
}
?>