General area when it fits no where else

Moderator: Mmiscool

User avatar
By forlotto
#50017
Code: Select all$dev=array(
    array('name'=>'Gdoor', 'esp_ip'=>'192.168.1.133', 'pin'=>3 ),
    array('name'=>'ACunit', 'esp_ip'=>'192.168.1.133', 'pin'=>1 ),
    array('name'=>'Light1', 'esp_ip'=>'192.168.1.134', 'pin'=>1 )
    );

foreach ($dev as $k=>$v) {
for each device as key variable
    $cmd=$_REQUEST[$dev[$k]['name']];
command  request device key name
    if ($cmd!='') {
if command equals
        $url="http://" . $dev[$k]['esp_ip'] . "/msg?";
the attributes of http://, device, espip, /msg?
   if ($cmd!='r') $url .= "pin=" . $dev[$k]['pin'] . "&";
if cmd equals r url = pin device key pin &
   $url .= "stat=" . $cmd;
url equals stat command
        $curl = curl_init($url);
curl equals curl initialize the url generated
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl set options curl and curl options return transfer true
        $output = curl_exec($curl);   
output equals curl execution of curl
        curl_close($curl);
curl close curl link given
        print $output;
print output of curl
    }
}


Keep trying to understand the code it does not make since to me the way that I see it...

I have tried to walk myself through understanding the code and it does not look as if it would even function correctly while I am quite likely dead wrong it just don't seem right the way I read it.

I wish to store every full command in an array and then access it according to the in in coming url.

http://WANIP/ACON would be array('name'=>'ACON', 'espreq'=>'192.168.1.133/msg?pin=D5stat=1')
http://WANIP/ACOFF would be array('name'=>'ACOFF', 'espreq'=>'192.168.1.133/msg?pin=D5stat=0')
http://WANIP/READAC would be array('name'=>'ACREAD', 'espreq'=>'192.168.1.133/msg?stat=r')

I would like each thing to be allowed to execute data locally and then return the response page to the browser so it can be seen remotely!

I don't know how else to put it.

So if I request ACON remotely using the servers IP http://WANIP/ACON

what happens next:

Look for ACON as a key
if it is a key then:
Send espreq
Return the Response page from local device to the remote requester.

I believe this should likely be a little more less complex than your code possibly to me it seems as if your code is doing way too much maybe I just am having trouble with php possibly?

Thanks in advance livetv!

By the way is there any easy way to serve up php on windows to do some testing I would bet there are some local web dev programs that you could forward to port 80 or some open source project that makes this type of testing easy on windows somewhere...

Anyways hope I can grab some insight on this one before I waste too much time on it maybe it is not possible in this manner IDK I guess I lack the understanding but to me it just does not seem as if this is what the code is doing.
User avatar
By villTech
#50028
forlotto wrote:Keep trying to understand the code it does not make since to me the way that I see it...
because you see things wrongly. try to do some more reading. maybe it can help.

forlotto wrote:By the way is there any easy way to serve up php on windows to do some testing I would bet there are some local web dev programs that you could forward to port 80 or some open source project that makes this type of testing easy on windows somewhere...
google is your friend.
you can try this anyway:
http://winlamp.sourceforge.net
http://www.ultraedit.com/support/tutori ... nment.html

another way is to sign up for a free domain. it requires lesser config set up.
most free hosting now have built in php. check their CPANEL.
User avatar
By forlotto
#50059 Yep I think I understand things a bit better the code is incorrect for what I want to do however the operand I was reading != lol yes I was reading this wrong as not equal.


The code provides plenty of insight enough to get things going I assume and lampstack perfect I could not remember the name of this tool I have used it before trying to create an android based website ....

I think misinterpretation is easy to do by anyone but I thank you at least for the lampstack link...

However if I thought google was my friend I would have used it spending time sifting through needless garbage if fine and dandy indeed to frankenstein something together however I always find it a little more easily learned with examples and explanations from real people rather than the pie in the sky.

Thus your link was splendid the exact thing that I was looking for I forgot the name of lampstack to be rather honest drew a blank I could have just tried to play trivia and say there was this one that I used that did this that and the other but I figured asking I may get even more information or maybe another project more dedicated to what I was trying to do ...

Thanks for the reply was a good placement of my foot at least headed to the path.