FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Regarding split text and match from data base
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Regarding split text and match from data base [message #183850 is a reply to message #183843] Fri, 22 November 2013 14:24 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/22/2013 6:28 AM, jalaf28(at)gmail(dot)com wrote:
> Hello All
> I just start learning PHP and i am using 5.4.16 i just want to split the out put of the following and match from the database and print the System name.
>
> here is the Code
>
> <?php
>
> ob_start();
> $line=shell_exec("arp -a");
> echo "<pre>;
> echo $line;
> echo "</pre>";
>
> ?>
>
> It shows the output of the command "arp -a" and show the Ip address and Mac address on the LAN system. i saved the name and the Mac address in the database.
> now i want to extaxct the command output and match ["MAc address] with database and show the Particular system name and Ip Address. i try google but not sufficent.
>
> i just want to show th eout put like
>
>
> IP Name
> 192.168.1.x Server1
> 192.168.1.x Client1
>
> Thanks
> Amit
>
>
>

Well, you will need to parse the output from your arp command to get the
list if IP addresses; a regex function such as preg_match_all will help
you here.

Then you take the output array and use the matching IP addresses to
search your database. The function calls will depend on the database
you're using.

You probably won't find anything like this on the internet; it's not the
type of thing that's commonly done (although there isn't any problem
with it).

BTW - why are you using ob_start()? It just adds overhead to the
process. There are very few reasons you ever need to use it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: creating key / hash
Next Topic: from mysql in associative array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 09:58:46 GMT 2024

Total time taken to generate the page: 0.05188 seconds