Jump to content

carolina-bound

New Members
  • Posts

    4
  • Joined

  • Last visited

carolina-bound's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I put in some logs which when run as AJAX call I can see that something is not quite right as test.txt has "BEFOREAFTER". So issue is not with return value. For some reason I am not kicking off bat file or something similiar, perhaps permission issues. I need to look at further. Apologies, I have actually spent a good amount of time on issue, but it appears that I am chasing shadows at the moment. exec("LoadZPL_PURL.bat", $output); $results = implode("|", $output); $results = 'BEFORE'.substr($results, 4, 5).'AFTER'; $myfile = fopen("c:\\temp\\test.txt", "w"); $txt = "$results"; fwrite($myfile, $txt); fclose($myfile); echo "$results";
  2. (1) When running code as a php.exe application via a command prompt output is "BEFOREProgrAFTER". (2) When running code as a javascript AJAX call to same php page in item (1) output is "BEFOREAFTER"
  3. I am eventually going to take the entire $output though replace carriage returns (or pipes in case of current code) with html break tags. Current pipe you see is legacy code I was testing with earlier. I wanted to make sure that issues were not being introduced due to carriage returns and escape characters in current $output so I just grabbed a small subset of data for my testing of passing data from php page to javascript ajax call. I then added "BEFORE" and "AFTER" as I still was not seeing anything passed in fiddler2.
  4. Where is my "Progr" return value? This is not my first day using php but I don't code in the language that often. I don't understand why my dynamic variable is not returned in AJAX GET? Essentially, I need to give the client a simple UI so that they can copy files to a printer and I wanted to provide a little unfiltered feedback so they knew whether operation was a success. My feedback was just going to be output of exec() function though cleaned up slightly (perhaps replace line breaks with html break tags). PHP version is 5.2.17.17 and cannot be upgraded. Web Server Apache. PHP dumbed down code: exec("LoadZPL_PURL.bat", $output); $results = implode("|", $output); $results = 'BEFORE'.substr($results, 4, 5).'AFTER'; echo "$results"; Results when run from command prompt give expected results of "BEFOREProgrAFTER". I just grabbed the substring here for a simple test, so that carriage returns and escape characters don't come into play. Results viewed in fiddler2 only give the following. Where is my "Progr"? HTTP/1.1 200 OK Content-Type: text/html Server: Microsoft-IIS/7.5 X-Powered-By: PHP/5.2.17 X-Powered-By: ASP.NET Date: Sun, 19 Oct 2014 18:58:35 GMT Connection: close Content-Length: 11 BEFOREAFTER I can post the AJAX code if really needed, I don't think issue resides here per fiddler2 trace, but here is fiddler2 request though I removed ip and a few client specific directory names. I haven't had problems with http requests in the past though I have never used in this fashion as I usually return record(s) from a table. GET http://x.x.x.179/custom/abc/reupload/LoadPrinterGraphic.php?&param1=document.getElementById(uncShare').value&param2=0.31039151530034853 HTTP/1.1 Accept: */* Accept-Language: en-us Referer: http://x.x.x.179/custom/abc/reupload/abc_populate_printer_purolator.php Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) Host: x.x.x.179 DNT: 1 Connection: Keep-Alive Cookie: PHPSESSID=0e4c2a01916297affd1df9e737283889 I dumbed down bat file for replication purposes. Bat file currently contains: copy plogo.grf plogo2.grf
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.