Jump to content

Transistor

New Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Transistor's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. Thanks, guys. I didn't get back to this for a week. I found that there was an error in the folder names after unpacking the files. The sample files all include `Sample_Header.php` (located in the samples folder. This has the lines, if (is_file(__DIR__ . '/../../Common/src/Common/Autoloader.php')) { include_once __DIR__ . '/../../Common/src/Common/Autoloader.php'; PhpOffice\Common\Autoloader::register(); } else { throw new Exception('Can not find the vendor or the common folder!'); } but the extraction of the install files created `Common-master`. Renaming the higher-level folder to `Common` seems to have resolved the problem. Hopefully this will help someone else.
  2. [PhpPresentation was formerly called PhpPowerpoint but renamed to avoid any issues with Microsoft.] The installation instructions, https://phppowerpoint.readthedocs.io/en/stable/installing.html, give the following instructions: require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; \PhpOffice\PhpPresentation\Autoloader::register(); require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php'; \PhpOffice\Common\Autoloader::register(); I've downloaded and unzipped the files onto my cPanel (reseller account - so no CLI). Where do I put the lines of code? There are no instructions on the site. Many thanks.
  3. Thanks, all. tcpdump 'tcp port 4001' works for low level stuff. If you're using it you need to limit the "count" so it will terminate after a while. Otherwise you'll have to kill the process. Seehttp://tcpdump.org
  4. Thanks, Thorpe. I've done some more reading and think that TCPDUMP might get me started. http://www.tcpdump.org/tcpdump_man.html. I'll try tcpdump 'tcp port 4001 As far as I can make out it should display all traffic in (and out) on port 4001. I've used php sockets on another small application but it was run from a CRON job. In this case I need to run a script every time traffic comes in on port 4001. I realise I can't leave a PHP script running waiting for an event. I'll see what I can come up with. Anyone else?
  5. I have a PC based vision inspection system capable of sending data strings of the measurements and results (possibly in XML format - I don't know yet). I can specify an IP address and port number on the sending application. I want to capture the measurement data and log it to a database. Q1. What Linux app can I run to monitor the port - say port 4001? (This should show me the raw data so I understand what's being transmitted.) Q2. What's the best way to capture data from that port using a php script? e.g. Can I redirect port 4001 to run a particular php script every time something shows up on that port? Many thanks.
  6. OK. I think I've found it. I inverted the $debug logic and, lo and behold I found that all the array values are = 50. This will give me a polygon all on one point! No wonder I can't see it. It's a good old-fashioned coding error. Thanks for the prompts.
  7. There are no conditions prior to populating the $X and $Y arrays. There are some calculations to fill them. The var_dump proves that my filling the array worked. I'll have another look and see if I've missed something stupid. Thanks again. Anyone else spot a boo-boo in my code?
  8. This has my head wrecked! :-\ I'm drawing a 4-point polygon for a png. I pass an 8-value array, $values, to imagefilledpolygon() to plot the poly. It doesn't work. I create an identical(?) array, $valuestest, and it does work. I do a var_dump for both and they appear identical. $values = array($X[0], $Y[0], $X[1], $Y[1], $X[3], $Y[3], $X[2], $Y[2] ); $valuestest = array( 10, 50, 31, 34, 86, 73, 64, 89); // -----0---- ------1----- ------3----- -----2------ if ($debug) { var_dump($values);echo "(values)<br>"; var_dump($valuestest);echo "(valuestest)<br>"; } else { header('Content-type: image/png'); $img = imagecreatetruecolor($imgw, $imgh); // set earlier in the script $blue = imagecolorallocate($img, 0, 0, 255); // draw a polygon if (!$test) { imagefilledpolygon($img, $values, 4, $blue); } else { imagefilledpolygon($img, $valuestest, 4, $blue); } imagepng($img); imagedestroy($img); } If debug is true then I get a dump as follows: array( { [0]=> int(10) [1]=> int(50) [2]=> int(31) [3]=> int(34) [4]=> int(86) [5]=> int(73) [6]=> int(64) [7]=> int(89) } (values) array( { [0]=> int(10) [1]=> int(50) [2]=> int(31) [3]=> int(34) [4]=> int(86) [5]=> int(73) [6]=> int(64) [7]=> int(89) } (valuestest) In normal mode (both debug and test false) I get a blank (black) image. If I set test true then I get a blue polygon on the black background (the desired result). I can't see any difference in the array contents. Why does $values fail while $valuestest works? ??? By creating the $values array with the contents of other arrays have I created a problem? Many thanks for taking the time to look at this.
×
×
  • 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.