# |
Sep 13th 2019, 08:54 |
conehead |
@info315 but thanks for your help. I am pretty sure I will need an API-Key shortly after |
# |
Sep 13th 2019, 08:47 |
info315 |
@admad was a try to not spam this off topic stuff between real questions |
# |
Sep 13th 2019, 08:43 |
admad |
@info315 if you use the silly threads i will just ignore your response :slightly_smiling_face: |
# |
Sep 13th 2019, 08:43 |
info315 |
This code is from an Cake2 app that I'm migration to cake4 at the moment... |
# |
Sep 13th 2019, 08:42 |
conehead |
So I call my script via http://myurl/myscript.php which `exec()`s my cake shell |
# |
Sep 13th 2019, 08:40 |
admad |
@info315 why are you reinventing Security::randomString() ? https://api.cakephp.org/3.8/class-Cake.Utility.Security.html#_randomString |
# |
Sep 13th 2019, 08:40 |
conehead |
No but my host allows to use exec. I could create a php script that is only allowed to be called locally. And this php script uses exec to call the cakephp shell |
# |
Sep 13th 2019, 08:39 |
info315 |
``` public function generateApiKey($len = 80) { $bytes = openssl_random_pseudo_bytes($len, $cstrong); $apikey = bin2hex($bytes); return $apikey; } ``` |
# |
Sep 13th 2019, 08:39 |
admad |
get your facts straight man :slightly_smiling_face: |
# |
Sep 13th 2019, 08:38 |
admad |
`exec()` is not for URLS |
# |
Sep 13th 2019, 08:38 |
conehead |
Well I might create an completely external script that uses exec |
# |
Sep 13th 2019, 08:37 |
admad |
yeah there are some shitty hosts which required URLs for cron jobs too |
# |
Sep 13th 2019, 08:35 |
conehead |
Well yes actually I can only call urls for cron jobs |
# |
Sep 13th 2019, 08:33 |
admad |
@info315 cpanel for e.g. can give access to cron jobs but not shell access :slightly_smiling_face: |
# |
Sep 13th 2019, 08:33 |
conehead |
I will just double check what I am allowed to do |
# |
Sep 13th 2019, 08:32 |
conehead |
Probably this wont work lol |
# |
Sep 13th 2019, 08:32 |
conehead |
ah well yes. |
# |
Sep 13th 2019, 08:32 |
info315 |
Didn't you say: >I can NOT create a command and call that via console. ^^ |
# |
Sep 13th 2019, 08:30 |
conehead |
https://book.cakephp.org/3.0/en/console-and-shells/cron-jobs.html#cron-jobs-on-shared-hosting ``` On some shared hostings cd /full/path/to/root andand bin/cake myshell myparam might not work. Instead you can use php /full/path/to/root/bin/cake.php myshell myparam. ``` |
# |
Sep 13th 2019, 08:30 |
conehead |
thank you but already found the answer |
# |
Sep 13th 2019, 08:30 |
conehead |
Ah |
# |
Sep 13th 2019, 08:29 |
info315 |
I guess adding Authentication Middleware and use the `Stateless Authenticators ` like an API key as HTTP Header or in the URL like `apikey=<key>` but this is only secure if HTTPS is used |
# |
Sep 13th 2019, 08:26 |
conehead |
I am looking for a safe way to realize this |
# |
Sep 13th 2019, 08:25 |
conehead |
I can NOT create a command and call that via console. Our host only allows to call URLs at given times |
# |
Sep 13th 2019, 08:25 |
conehead |
I need to send E-Mails daily at 8 am |
# |
Sep 13th 2019, 08:24 |
info315 |
@conehead What? |
# |
Sep 13th 2019, 08:20 |
conehead |
I have a few URLs that should only be called internally. Unfortunately I can not execute ssh commands, that is why I have to execute some commands via cronjob and call urls. What would be a nice way to realize this? |
# |
Sep 13th 2019, 08:11 |
javier.villanueva |
ok |
# |
Sep 13th 2019, 08:10 |
admad |
debug the entities |
# |
Sep 13th 2019, 08:10 |
admad |
if there are no exceptions it means validation / application rules failure |
# |
Sep 13th 2019, 08:10 |
javier.villanueva |
savemany returns false, but no errors in debug |
# |
Sep 13th 2019, 08:10 |
admad |
you have the query log in debugkit |
# |
Sep 13th 2019, 08:09 |
javier.villanueva |
I use saveMany to save any entities, but there are any problem.... Is there any log to see more info? |
# |
Sep 13th 2019, 08:09 |
birdy247 |
:slightly_smiling_face: |
# |
Sep 13th 2019, 08:09 |
admad |
i think of myself and simply mad |
# |
Sep 13th 2019, 08:08 |
birdy247 |
@admad Some would say you are a genious |
# |
Sep 13th 2019, 08:07 |
admad |
@birdy247 `$uri = $this->request->getUri()->withHost($newHost); return $this->redirect((string)$uri);` |
# |
Sep 13th 2019, 08:06 |
birdy247 |
parse_url($this->getRequest()->getUri()) |
# |
Sep 13th 2019, 08:04 |
birdy247 |
@admad this is waht I have decided. I was looking for a method on getRequest->getUri and couldnt find one |
# |
Sep 13th 2019, 08:04 |
admad |
you need parse_url() at best |
# |
Sep 13th 2019, 08:03 |
admad |
@birdy247 if all you need to do is change the host of the URL why do you need to bother with router? just use basic string manipulation |