The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 21, 2019, 06:24:48 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Help for a newbie please?  (Read 4037 times)
Con
Rookie
**
Offline Offline

Posts: 20


Who's Next?


View Profile
« on: December 28, 2007, 03:45:23 PM »

 Praise

Don't laugh too hard at me  Wink  ROFLMAO

How do I pass a variable back to a program which I've run from command line?

Example: This program is mainprogram.php
Code:
<?php
$cwd getcwd();
$cmd 'php '.$cwd.'/mainkey1.php';
$cmdStatus = `$cmd`;
echo($cmdStatus); 
?>


That runs program mainkey1.php

Let's say mainkey1.php reads a file and outputs data into a variable called $main1

How do I get that variable ($main1) which was run in mainkey1.php BACK into this program (mainprogram.php)?

I don't just want to do an include because I want to run this within a loop.

I don't know what you guys would call this but essentially I want the ability to "CALL" another php program from within one and take the output of that second program and do what I want with it in the first.

Have I made ANY sense at all?  ROFLMAO

Thanks for helping a newbie out.  Embarrassed

Con
« Last Edit: December 28, 2007, 04:33:34 PM by Con » Logged

I can't code. I'm just here to annoy all of you!
Con
Rookie
**
Offline Offline

Posts: 20


Who's Next?


View Profile
« Reply #1 on: December 28, 2007, 05:14:29 PM »

Never mind...I got this to work with an include...I'm a dumbass!  D'oh!
Logged

I can't code. I'm just here to annoy all of you!
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: December 28, 2007, 05:28:14 PM »

NW Con... and the way that you'd do something similar is call program b from program a with shell_exec which would allow you to see the output from program b as a variable in program a. Confusing, I know, but consider:

Program A:
Code:
#! /usr/local/bin/php
<?php

$resultsFromB 
shell_exec('./programB.php');
echo 
"The results of program B are: $resultsFromB";

?>


Program B
Code:
#! /usr/local/bin/php
<?php

echo 'Hello World!';

?>


If you chmod 755 program A and B, then run program A, you'd see:

The results from program B are: Hello World

This is REALLY the long way around - the include is obviously better, but this makes for an interesting exercise in any case.

/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Con
Rookie
**
Offline Offline

Posts: 20


Who's Next?


View Profile
« Reply #3 on: December 28, 2007, 05:33:41 PM »

Gracias Amigo...And hope you and yours had a Merry Christmas!  Praise

Con
Logged

I can't code. I'm just here to annoy all of you!
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: December 29, 2007, 01:00:21 PM »

Still having it my friend, hope you are as well. Scoffing wifi from the resort next door to us in MX, so my connection is spotty but good when the air is right. Hope the new year brings you everything you are hoping for.

/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #5 on: December 29, 2007, 01:13:10 PM »

a buffalo wifi card with 6 foot cord to magnetic antennae 7db boost
would be good for scoffage
Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: December 30, 2007, 12:15:34 PM »

Love to hear more about that... unfortunately parts are difficult to come by here in MX, but when I return home that sounds like an excellent thing to put together for my road kit. Design plan, parts and instrux thread please?
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #7 on: December 31, 2007, 11:47:04 AM »

Buffalo is wonderful. Probably the best wifi card company for reference chipsets, and their hardware works on almost all Linux distros (supported in 2.4.x kernel on I think).

Buffalo card + cantenna is what I use when travelling. I can pick up wifi networks at approx. 1 mile away given decent terrain with few obstructions. As long as the wifi network is less than a mile away, I get solid reception as well.
Logged

hai
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #8 on: December 31, 2007, 11:54:40 AM »

Here ya go dude, this guy will sell them both to you on ebay.... or
circuit city had one i picked up about two months ago...

I wouldnt put the magnet on my laptop like in the picture though lol....ill
save the magnets for my perpetual motion machine but here ya go:


http://cgi.ebay.com/NEW-Buffalo-Turbo-Power-WLI-CB-G54HP-7dBi-OMNI-Antenna_W0QQitemZ200186852295QQihZ010QQcategoryZ40992QQtcZphotoQQcmdZViewItem



Works wonders where i am signal less and pops on the car hood like old
school cellie antennae coulda scoffed from linda carters dads building
with this from 43rd and Glendale...hahaha



Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #9 on: December 31, 2007, 12:38:24 PM »

That looks sweet, although my Powerbook has the new expressport rather than the standard shape pcmcia... I'll look at the USB version and see if that can help me out. Thanks man
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
ratthing
Journeyman
***
Offline Offline

Posts: 75


View Profile
« Reply #10 on: January 05, 2008, 04:48:45 PM »

If you don't want to make your own antenna, Hawking makes some nice ones for low cost as well.

=RT=
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!