Merhaba, umarım aktif birileri vardır.
PHP Öğreniyor ve bir proje yapmaya çalışıyorum.
Konu şu: "telekom" kelimesi geçen bir ASN bilgisi siteye erişirse IF bloğu çalışacak.
Eğer ASN bilgisinde "telekom" kelimesi geçmiyorsa ELSE bloğu çalışacak.
Cpanel üzerinde düzenleme yaparken " use Facebook\Webdriver; " şu bölümü IF sonrasına yazdırmayıp hata vermişti, bende bu yüzden IF bloğu öncesine yazdım, umarım bu ve diğerleri doğrudur.
<?php
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
$useragent=$_SERVER['HTTP_USER_AGENT'];
$hata = array();
$api = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
$ulke = $api->isp;
use Facebook\Webdriver;
if( preg_match("/telekom/i", $ulke))
{
require_once __DIR__ . '/vendor/autoload.php';
$host = 'http://localhost:4444/wd/hub';
$proxyUrl = 'xx.xx.xx.xx:50100';
$capabilities = new Facebook\WebDriver\Remote\DesiredCapabilities(
[
Facebook\WebDriver\Remote\WebDriverCapabilityType::BROWSER_NAME => 'chrome',
Facebook\WebDriver\Remote\WebDriverCapabilityType::PROXY => [
'proxyType' => 'manual',
'httpProxy' => $proxyUrl,
'sslProxy' => $proxyUrl,
],
]);
$driver = Facebook\WebDriver\Remote\RemoteWebDriver::create($host, $capabilities);
$driver->get("https://xxxx.com");
$driver->manage()->window()->maximize();
sleep(1);
$page_source = $driver->getPageSource();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
echo $page_source;
$driver->quit();
exit;
}
else {
$url = "https://xxxxx.com";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;
exit;
}