How to send modbus rtu frame from php? It is possible?
It is possible to build and send data from php to rs485 port? For device modbus rtu .. I know, php doesn't have access to hardware but maybe.. I would like to control devices (techbase I/O) from website..
See also questions close to this topic
CSRF cookie does not work in Laravel Sanctum and VueJS
I am using Laravel sanctum for SPA authentication. My front-end is VueJS, Vue2 to be more precise.
- I have already set
SESSION_DOMAIN=.domain.tld. I have edited my hosts file to change my localhost to
- I have added
SANCTUM_STATEFUL_DOMAINSin my environment file in Laravel.
Still, when I try to access my web app through
dev.domain.ltd:8080, sanctum returns nothing (giving a 204/no-content status code) and obviously my next requests are blocked, giving a 419 status code. This is what
sanctum/csrf-cookiereturns in the
app_session=eyJpdiI6IjM4MzJvTEJVMjdiVTFvQkJKUFNUeVE9PSIsInZhbHVlIjoiK3d3TkZEcVRwT1BTTzdweFpiSE5HTFpKaDhnby9ST2VKNmxSemM4Y3FFZ1ZwYlRmTDRzbmNQaDlPN25LOTkweHN5WnlxNUp2SXU4S3pEQ2hHYStyaTN0d1RFUVByVDNDRk5qSGo1WVYwS0llTkhIVHZEQ2dQZU15K0phS1NPTi8iLCJtYWXiOiI5ZTdjMAMwZDQzMzNhZTEyODI3NWYxY2M5YWE1N2ViOTdlYmU3MmQxMTUxNzhmYjQ3YTY2OTUzZTlhZWFiMWYyIn0=; expires=Wed, 05-May-2021 12:46:01 GMT; Max-Age=7200; path=/; domain=.domain.ltd; httponly; samesite=lax
XSRF-TOKEN=eyJpdiI6IlZqVVQ2Yk2LLzc5Y0RJR0p3UW9sWEE9PSIsInZhbHVlIjoiVnY5WFZsUXExbFY2Z3JiMldsOHp5UjlFNE9JZkRlOXURQzZDRFhLWU1oNXE3eEZvT2xyaGFoQ0FxcnM2U3YxZk9Ed1JndkJSbE5sTkhvdnlmZmlXYmhXMHhocHI4bTQ0dGxZY5F1QnhmazBSRnhKL0RsbVFCTFZuYkpPZlJjSmEiLCJtYWMiOiI2MDY3YzAyNWFlZmI2ZjdcMmUxODczODA3ZTM5YjMxOGY2ZTMxZWI0MzdhOWJlMzY5OGYwN2U3YTUzZDhhOTliIn0%3D; expires=Wed, 05-May-2021 13:01:43 GMT; Max-Age=7200; path=/; domain=.domain.ltd; samesite=lax
In my browser (Chrome), I can see only one cookie set which is
Even though I have set
withCredentialsto true in
axios, I'm still getting a 419 error all the time.
This question seems to be related to my problem but it is for Angular. I'm using absolute paths instead of relative paths as well.
- I have already set
phpseclib login to SFTP working on windows but not on linux
when tried logging in to the SFTP server using key and password on windows machine, I am successfully able to login and transfer files from local to remote. The same code fails when i've pushed my code to gitLab which points to a linux machine..
I tried printing
$sftp->getLog()which returns the logs on windows but on linux it just prints
pretags and nothing inside these tags.
I'm using phpseclib 1.0.19 and php version 7.3
for logging in i'm using the code:
$sftp=new Net_SFTP('hostIPAddress'); $key= new Crypt_RSA(); $key->setPassword('passphrase'); $key->loadKey(file_get_contents('Path to private key')); $rs=$sftp->login('username','password',$key); print_r($sftp->getLog()); //prints logs on windows and nothing inside pre tags on linux print_r($sftp->getSFTPLog()); // prints something on windows but nothing on linux print_r($sftp->getSFTPErrors()); print_r($sftp->getErrors());
Logs come fine on the windows machine but empty when on linux..
Help the code is working fine on my local windows machine..
Also while loading the key on windows local, one of the keys inside the $key array named 'modulus' gets initialised to a BigIntegerMath object with an int value in 'value' key but when I try printing the contents of the $key array on linux server this prints the other array contents correctly but for that 'value' key it just shows:
value=Array (no int value as in windows machine case).
Help needed why is this happening!
Approach to place results of a php script inside a div (without jQuery)
I am making a system in which you can place plants on a map. I made a pen that shows what the user will see: https://codepen.io/dcslob/pen/vYxBMdp The actual map image is missing, but you will get the point.
If you click one one of these pins
<div id='25' class='specimen size_20' [...] data-species='Agastache mexicana'>a</div>
this div will appear on top of it:
<div id='description'>I should be PHP/mysql generated text!</div>
I'd like to put some text from the database in this div, based on the id of the plant. However, I am unsure about the way to proceed with this. These are my options:
- I could preset a separate hidden description div for each species on the map when I generate the page. That would add a lot of data if somebody uses 100+ species on a map. It would be pretty responsive, though.
- One of you has a far more cunning plan.
This is not a request for a copy/paste solution (I wouldn't mind it, though), I'd like an opinion about the direction I should be looking in, preferably with some examples. I am trying to learn as much as possible from this project, which is why I don't want to use libraries if I can do it myself.
I hope this isn't too wordy, I find it hard to be concise about things I am not sure of myself. Thanks in advance!