GREAT comment thread at: https://stackoverflow.com/a/6398220/1679026 gave me hope but I failed to solve my issue. When I use cURL to fetch the www.php.net page, it works so cURL works
I have a network-appliance that lives on a local LAN (http://192.168.1.117) here, or at my client site the devices (n) are on their LAN (173.18.13.xxx). From a Local_Browser_Address I can type "http://192.168.1.117/#diag/term&cmd=signage+sign+ALARM" and the network-appliance responds with a change to the "ALARM" state. <-- That is what I want to automate with one button!
On my web form I have $_POST PHP code to execute when the Alarm_Button is clicked. I want the user on my clients physical site to be able to click the_button on my web_form (www.mySite.com/index.php?option=com_rsform&formId=27) in -their browser- and have cURL code send/Post/execute that (http-ALARM) address/instruction string. Can I do this thing? No UI Required at or after address/instruction is sent.
I tried:
$c = curl_init('http://192.168.1.117/u/r/l');
curl_setopt($c, CURLOPT_HTTPHEADER, array('#diag/term&cmd=signage+sign+ALARM'));
curl_exec($c);
AND
$curl = curl_init();
echo"<br> the curl resource is ch --> $curl";
curl_setopt ($curl, CURLOPT_URL, "http://192.168.1.117");
curl_setopt ($curl, CURLOPT_POST, "/#diag/term&cmd=signage+sign+CELL_IN_ALARM");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
echo"<br> The RESULT (1) is --> $result";
No error message but no useful result.
First: I am afraid I am being stopped by the security restrictions like "no_outside_web_page_doing_junk_locally" kind of rules.
IF I have to create a local page on an internal web server, I can do this on another device on the same/adjacent network. But the problem remains for me, how to express the ip/command instruction in the cURL tools.
I have scoured the StackOverFlow information and it seems like I am close but missing the "glaring truth" somewhere!
Hope my challenge is worthy of your interest. Thank you. ---UPDATE---
the "Sent" values (461) above and below the one (484) highlighted have respective POST Data of:
{"version":"1.1","method":"unit.baseInfo","id":28,"params":[]}
{"version":"1.1","method":"term.cmd","id":29,"params":["signage sign CELL_IN_ALARM"]}
{"version":"1.1","method":"unit.baseInfo","id":30,"params":[]}
This shows Types application/jason and URLs of -http://192.168.1.117/jasonrpc-(jasonRemoteProcedureCall?)
Does this simplify or complicate my struggle?
-- New Update --
When I run the following code I get the php.net home page and a blank return "...is -->" for the second return...
// From http://www.tuxradar.com/practicalphp/15/10/2
$curl1 = curl_init();
curl_setopt ($curl1, CURLOPT_URL, "http://www.php.net");
curl_setopt($curl1, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl1);
curl_close ($curl1);
print $result;
//====================
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://192.168.1.117");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
//print $result;
echo"<br> The RESULT (1) is --> $result";
The first one is a www and the second one is the device on my network. Is this a primitive Network/Web conflict? Really appreciate the brain cycles here!
the curl resource is ch --> $curl"; curl_setopt ($curl, CURLOPT_URL, "http://192.168.1.117"); curl_setopt ($curl, CURLOPT_POST, "/#diag/term&cmd=signage+sign+CELL_IN_ALARM"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($curl); curl_close ($curl); //print $result; echo"
The RESULT (1) is --> $result"; – LongTimeHack Nov 16 '12 at 03:07
the curl resource (2) is ch --> $c"; curl_setopt($c, CURLOPT_HTTPHEADER, array('Host: /#diag/term&cmd=signage+sign+CELL_IN_ALARM')); // "/#diag/term&cmd=signage+sign+CELL_IN_ALARM"); $result = curl_exec($c); echo"
The RESULT (2) is --> $result"; – LongTimeHack Nov 16 '12 at 03:08