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?¶m1=document.getElementById(uncShare').value¶m2=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