Re: [Linux-programlama] php-cli server ip

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Bahri Meriç CANLI (bahri@canli.info)
Date: Wed 21 Feb 2007 - 15:48:39 EET


Merhaba

Benim isteiğim sunucunun iç ipsiydi ( 192.168.1.150 gibi)

<?php

    if ($fp = fopen('/proc/sys/kernel/hostname', 'r')) {
        $result = trim(fgets($fp, 4096));
        fclose($fp);
        echo gethostbyname($result);
        }

?>

şeklinde bir çözüm buldum.

Yinede cevap için teşşekkür ederim.

Agah ALICI yazmış:
> <?php
>
> function readurl($file)
> {
> @ob_start();
> @readfile($file);
> $output = @ob_get_contents();
> @ob_end_clean();
> return $output;
> }
>
> $Data = readurl("http://www.whatismyip.com");
> preg_match("/\<h1>Your[\s]IP[\s]Is[\s]([0-9\.]+)\<\/h1>/i", $Data,
> $Matches);
> echo "<xmp>"; print_r($Matches); echo "</xmp>";
> Echo "IP adresi : " . $Matches[1];
> ?>
>
> Çözüm çözümdür :)
> Kolay gelsin.
>
>
>
> -----Original Message-----
> From: linux-programlama-bounces@liste.linux.org.tr
> [mailto:linux-programlama-bounces@liste.linux.org.tr] On Behalf Of Bahri
> Meriç CANLI
> Sent: Wednesday, February 21, 2007 2:15 PM
> To: linux-programlama@liste.linux.org.tr
> Subject: [Linux-programlama] php-cli server ip
>
> Merhaba
>
> php-cli yada php-cgi üzerinde çalışan kodun çalıştığı serverin ip adresini
> nasıl elde edebilirim.
>
> iyi çalışmalar
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
> ----------------------------------------------------------------------------
> --------
> Bu E-Posta Sakarya Universitesi E-posta Sunucusu Araciligiyla Size
> Ulastirilmistir.
>
> SAU >> BIDB >> Ar-Ge S.M. >> Sistem Yonetimi Servisi
>
> BitDefender Antivirus Yazilimi Tarafindan Virus Taramasindan Gecirilmistir.
>
>
>
>
> ------------------------------------------------------------------------------------
> Bu E-Posta Sakarya Universitesi E-posta Sunucusu Araciligiyla Size Ulastirilmistir.
>
> SAU >> BIDB >> Ar-Ge S.M. >> Sistem Yonetimi Servisi
>
> BitDefender Antivirus Yazilimi Tarafindan Virus Taramasindan Gecirilmistir.
>
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.