Search found 12 matches
- Mon Jan 25, 2010 1:08 pm
- Forum: PHP - Code
- Topic: exec/passthru/system converts float automatically
- Replies: 6
- Views: 48
Re: exec/passthru/system converts float automatically
Here is the PHP code: ob_start(); passthru("sudo /opt/bin/loadinfo"); $rawXml = ob_get_contents(); ob_end_clean(); var_dump($rawXml); Output: <loadsize>0.0</loadsize> Here is what I type in the command line: sudo /opt/bin/loadinfo Output: <loadsize>5639.2</loadsize>
- Mon Jan 25, 2010 12:32 pm
- Forum: PHP - Code
- Topic: exec/passthru/system converts float automatically
- Replies: 6
- Views: 48
Re: exec/passthru/system converts float automatically
But I get the same results if I use the PHP command line interface. And that isn't using apache user. 
- Mon Jan 25, 2010 12:21 pm
- Forum: PHP - Code
- Topic: exec/passthru/system converts float automatically
- Replies: 6
- Views: 48
Re: exec/passthru/system converts float automatically
That can't be true.
If I run the program from the command line it outputs...
<loadsize>5639.2</loadsize>
If I run the program from PHP using passthru it outputs...
<loadsize>0.0</loadsize>
If I run the program from the command line it outputs...
<loadsize>5639.2</loadsize>
If I run the program from PHP using passthru it outputs...
<loadsize>0.0</loadsize>
- Mon Jan 25, 2010 11:28 am
- Forum: PHP - Code
- Topic: exec/passthru/system converts float automatically
- Replies: 6
- Views: 48
exec/passthru/system converts float automatically
I am executing an external program that returns some output that I need to read (in XML format). One of the elements returned is a float in string format (e.g. <loadsize>5639.2</loadsize>). The problem is the output that is returned using exec, system, or passthru is <loadsize>0.0</loadsize>. It see...
- Mon Jan 18, 2010 3:57 pm
- Forum: Javascript
- Topic: eval and JSON problem
- Replies: 6
- Views: 583
Re: eval and JSON problem
pytrin - You're awesome!!! That was it. Thanks!!!!pytrin wrote:try changing the eval command to this:Also, I'm assuming you've checked that jsonText contains the data you are expecting?Code: Select all
var jsonObject = eval('(' + jsonText + ')');
- Mon Jan 18, 2010 3:35 pm
- Forum: Javascript
- Topic: eval and JSON problem
- Replies: 6
- Views: 583
Re: eval and JSON problem
here is the php code as well
$oldRec is string
$newrec is string
$messages is array
Code: Select all
$logCollection = array("oldRec" => $oldRec, "newRec" => $newRec, "messages" => $messages);
echo json_encode($logCollection);
$newrec is string
$messages is array
- Mon Jan 18, 2010 3:33 pm
- Forum: Javascript
- Topic: eval and JSON problem
- Replies: 6
- Views: 583
Re: eval and JSON problem
xmlHttp2 = GetXmlHttpObject(); if (xmlHttp2 == null) return; xmlHttp2.onreadystatechange = function() { if (xmlHttp2.readyState == 4) { var jsonText = xmlHttp2.responseText; [color=#FF4000]var jsonObject = eval(jsonText);[/color] ...
- Mon Jan 18, 2010 3:21 pm
- Forum: Javascript
- Topic: eval and JSON problem
- Replies: 6
- Views: 583
eval and JSON problem
I encoding a php array with json_encode and then trying to use eval in javascript to decode the array. It is not working. Nothing happens - not even an error. If I debug my javascript and step over the line that runs eval() it never goes to the next line of code. if I print out the literal string ou...
- Fri Jan 08, 2010 7:00 pm
- Forum: PHP - Code
- Topic: No output from passthru() function
- Replies: 2
- Views: 801
No output from passthru() function
Here is my code: ob_start(); passthru ($linuxCommand); $rawXml = ob_get_contents(); ob_end_clean(); $xmlParser = xml_parser_create(); xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8"); xml_parse_into_struct($xmlParser, $rawXml, $vals, $index); xml_parser_free($xmlPar...
- Fri Jan 08, 2010 5:57 pm
- Forum: PHP - Code
- Topic: xml parser question
- Replies: 2
- Views: 144
Re: xml parser question
well i figured out my problem. There was a syntax problem with the xml output...
<rec num="18" type=1">
was missing a quote. should have been...
<rec num="18" type="1">
<rec num="18" type=1">
was missing a quote. should have been...
<rec num="18" type="1">
- Fri Jan 08, 2010 4:33 pm
- Forum: PHP - Code
- Topic: xml parser question
- Replies: 2
- Views: 144
Re: xml parser question
oops forgot to post my code... <?php ob_start(); passthru("$executable"); $rawXml = ob_get_contents(); ob_end_clean(); $xmlParser = xml_parser_create(); xml_parser_ser_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8"); xml_parse_into_struct($xmlParser, $rawXml, $vals, $in...
- Fri Jan 08, 2010 4:29 pm
- Forum: PHP - Code
- Topic: xml parser question
- Replies: 2
- Views: 144
xml parser question
i am trying to get a data structure from and xml string using the xml_parse_into_struct() function. My problem is that its adding only the first tag of my xml string. my xml string looks like this: <?xml version="1.0" encoding=UTF-8"?> <UserLog> <rec num="18" type=&quo...