Hi saed
to extract all ips use:
$file = file_get_contents('ip.txt');
if (preg_match_all("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $file, $ips))
{
print_r($ips);
}
to extract the first ip use:
$file = file_get_contents('ip.txt');
if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $file, $ips)) {
echo $ips[0];
}
On Jan 23, 2008 1:31 PM, Saeed Al Mullah <[EMAIL PROTECTED]> wrote:
>
> No , i want only this .
> IP Address. . . . . . . . . . . . : 192.168.1.68
>
> On Jan 23, 2008 1:22 PM, Ammar Ibrahim <[EMAIL PROTECTED]> wrote:
> > Hello Saeed,
> > Do you want to extract all IP Addresses from the file?
> >
> > - Ammar
> >
> >
> >
> > On Jan 23, 2008 11:26 AM, Saeed Al Mullah <[EMAIL PROTECTED] > wrote:
> > >
> > >
> > >
> > >
> > > Hi all
> > > i have this file
> > > ----
> > > ip.txt
> > >
> >
> [--------------------------------------------------------------------------------------]
> > > Windows IP Configuration
> > >
> > >
> > > Ethernet adapter Local Area Connection:
> > >
> > > Connection-specific DNS Suffix . :
> > > IP Address. . . . . . . . . . . . : 192.168.1.68
> > > Subnet Mask . . . . . . . . . . . : 255.255.255.0
> > > Default Gateway . . . . . . . . . : 192.168.1.254
> > >
> > >
> >
> [--------------------------------------------------------------------------------------]
> > >
> > > i want to extract the IP address 192.168.1.68 from this file ...
> > > how can i ?
> > > this is the first time i deal with file ( reading and writing ) in php
> .
> > > i hope u can help me..
> > > thanks
> > > --
> > > Saeed Mullah uthman
> > > Mob: +966 56 7849842
> > >
> > > > >
> > >
> >
>
>
>
> --
> Saeed Mullah uthman
> PHP developer
> President of P.A club :-) ask me about it
> Mob: +966 56 7849842
>
> >
>
--
Tariq Abuzaid
www.dwwen.com
+962796638315
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---