v2.5.2
Giriş yap

Veri olmayan php api'yi çalıştırmama

erdal42
414 defa görüntülendi ve 1 kişi tarafından değerlendirildi
<div class="kutucugumuz"></div>

<?php

if ( isset($_GET['language']) ) {
  $language = $_GET['language'];
} else {
  $language = 'en';
}

if ( isset($_GET['userAgent']) ) {
  $userAgent = $_GET['userAgent'];
} else {
  $userAgent = 'WikiBot/1.0 (+http://'.$_SERVER['SERVER_NAME'].'/)';
}

if ( isset($_GET['betterResults']) and
     ($_GET['betterResults'] == 'false' or $_GET['betterResults'] == 0) ) {
  $betterResults = false;
} else {
  $betterResults = true;
}

if ( isset($_GET['proxy']) ) {
  $proxy = $_GET['proxy'];
} else {
  $proxy = null;
}

if ( isset($_GET['imageProxy']) and
     ($_GET['imageProxy'] == 'false' or $_GET['imageProxy']== 0) ) {
  $imageProxy = false;
} else {
  $imageProxy = true;
}

if ( isset($_GET['DEBUG']) ) {
  $DEBUG = $_GET['DEBUG'];
} else {
  $DEBUG = null;
}

// Set the Parameter
$options = array(
  'language'      => $language,
  'userAgent'     => $userAgent,
  'betterResults' => $betterResults,
  'proxy'         => $proxy,
  'imageProxy'    => $imageProxy,
  'DEBUG'         => $DEBUG,
);


require_once __DIR__.'/ciktisi.php';

// Start the Wikipedia API Class
$wiki = new wiki($options);

// Output the API Response
echo $wiki->api($_GET['q']);

// Print the Script Runtime in DEBUG Mode
if ( isset($DEBUG) ) {
  echo "<pre>\n\n\tRuntime: ".number_format((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT']),3);
   }

?>

Merhabalar, yukarıdaki kodda aramalarda mesela üste verdiğim div'i apilerde sonuç çıkmayınca sadece içi boş kutucuk çıkıyor. Eğer sonuç yok ise nasıl tamamen div'i kaldırabiliriz ?

erdal42
564 gün önce
<div class="kutucugumuz"><div class="bilgi viki5">
<h3 class="yazilar"><i class="ikon"></i> Türkçe wikimiz</h3></div><div class="sag-bilgi"><div class="left-s"><span class="digerb"></span></div><div class=""><div class="kucuk"><div class="">
<?php

$language = isset($_GET['language']) ? $_GET['language'] : 'tr';

$userAgent =  isset($_GET['userAgent']) ? $_GET['userAgent'] : 'WikiBot/1.0 (+http://'.$_SERVER['SERVER_NAME'].'/)';

$betterResults = !( isset($_GET['betterResults']) && ($_GET['betterResults'] == 'false' || $_GET['betterResults'] == 0));

$proxy = isset($_GET['proxy']) ? $_GET['proxy'] : null;

$imageProxy = !(isset($_GET['imageProxy']) && ($_GET['imageProxy'] == 'false' || $_GET['imageProxy']== 0));

$DEBUG = isset($_GET['DEBUG']) ? $_GET['DEBUG'] : null;

// Set the Parameter
$options = array(
  'language'      => $language,
  'userAgent'     => $userAgent,
  'betterResults' => $betterResults,
  'proxy'         => $proxy,
  'imageProxy'    => $imageProxy,
  'DEBUG'         => $DEBUG,
);

require_once __DIR__.'/ciktisi.php';

// Start the Wikipedia API Class
$wiki = new wiki($options);

// Output the API Response
$apiResult = $wiki->api($_GET['q']);
if($apiResult) { echo $apiResult; ?>
    
    <div>Buraya sonuç döndüğünde ne istiyorsak o içerik gelecek. kutucuk, küçük, div'ler vs her ne istersek buraya...</div>
    
<?php exit(); }
else { ?>

<style>
.kutucugumuz {
display:none;
}
</style>
    
<?php }

// Print the Script Runtime in DEBUG Mode
if ( isset($DEBUG) ) {
    echo "<pre>\n\n\tRuntime: ".number_format((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT']),3);
    exit();
}
?>

</a></div></div></div><div class="son sag-taraf"><span class="dd"></span></div></div></div>