# |
Jun 25th 2019, 16:06 |
nucc1 |
like, i've already set function add() for handling the Adding, if i wanted a REST method of doing something, i suppose i have to create something like function restAdd() ? |
# |
Jun 25th 2019, 16:05 |
nucc1 |
when adding a restful route to my application, do i have to have separate methods for both the REST and non-REST request? |
# |
Jun 25th 2019, 15:32 |
ricksaccous |
no problem |
# |
Jun 25th 2019, 15:32 |
a.didier |
thank |
# |
Jun 25th 2019, 15:32 |
a.didier |
I was doing something wrong don't find what and now it's works with ``` $HTTPSocket = new HttpSocket(array('request'=>array('header'=>array("User-Agent"=>"TEST"))));``` |
# |
Jun 25th 2019, 15:26 |
ricksaccous |
but yeah, hopefully the constructor way just works |
# |
Jun 25th 2019, 15:26 |
ricksaccous |
if that doesn't work try passing it in, you could probably just set the request array as a variable and pass it to all three |
# |
Jun 25th 2019, 15:24 |
a.didier |
i'll try to pass it inside the constructor |
# |
Jun 25th 2019, 15:24 |
a.didier |
i use the wrapper get but i want this to work over get post put... ``` $HTTPSocket = new HttpSocket(); $HTTPSocket->request['header']['User-Agent'] = "MyUserAgent"; $response = $HTTPSocket->get($full_url); debug($response); ``` With this i call an other site that's telling me my user agent is still CakePHP. |
# |
Jun 25th 2019, 15:24 |
ricksaccous |
new HttpSocket(array('request' => array('header' => array('User-Agent' => 'My Agent |
# |
Jun 25th 2019, 15:23 |
ricksaccous |
it says in the comments that that's read only |
# |
Jun 25th 2019, 15:23 |
ricksaccous |
in order for it to work |
# |
Jun 25th 2019, 15:23 |
ricksaccous |
you'd have to set that in the constructor |
# |
Jun 25th 2019, 15:22 |
ricksaccous |
also |
# |
Jun 25th 2019, 15:21 |
ricksaccous |
or are you not using those? |
# |
Jun 25th 2019, 15:21 |
ricksaccous |
are you using get or post? |
# |
Jun 25th 2019, 15:21 |
a.didier |
``` $HTTPSocket = new HttpSocket(); $HTTPSocket->request['header']['User-Agent'] = "My User Agent" ``` Didn't do anything, i've still the "CakePHP" for User-Agent... |
# |
Jun 25th 2019, 15:19 |
ricksaccous |
should over-ride it |
# |
Jun 25th 2019, 15:18 |
ricksaccous |
https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Network/Http/HttpSocket.php#L47 that's the default i guess but you can feed it your own params in the third param of get, post, patch, etc |
# |
Jun 25th 2019, 15:16 |
ricksaccous |
User-Agent is just a header thing right? |
# |
Jun 25th 2019, 15:16 |
ricksaccous |
which i think is the third param if you use get or post |
# |
Jun 25th 2019, 15:15 |
ricksaccous |
in the request |
# |
Jun 25th 2019, 15:15 |
ricksaccous |
@a.didier yeah I think you just set the 'header' array |
# |
Jun 25th 2019, 15:09 |
a.didier |
Hi, is this possible to change the User-Agent when using HttpSocket on Cake 2.10 ? |
# |
Jun 25th 2019, 13:18 |
akimov.dev |
Oh, thank you very much! It helped me to fix the problem |
# |
Jun 25th 2019, 13:14 |
admad |
since the error message shows `crud\\action |
# |
Jun 25th 2019, 13:14 |
admad |
that's the case |
# |
Jun 25th 2019, 13:12 |
vossen.steven |
guessing its your host being case sensitive and local not |
# |
Jun 25th 2019, 13:10 |
akimov.dev |
I get the error Class '\\App\\crud\\action\\IndexByCategoryAction' not found. This happens while using hosting. At the local server all works well |
# |
Jun 25th 2019, 13:08 |
madbbb |
you can try |
# |
Jun 25th 2019, 13:05 |
akimov.dev |
Hello! I have got some problem with crud plugin once I've uploaded my project to the hosting. Whether I can apply for a help here? |
# |
Jun 25th 2019, 13:03 |
neon1024 |
Yes |
# |
Jun 25th 2019, 13:01 |
adriencs |
hi guys, gurlz, it is possible to $this->redirect out of prefixed route ? |
# |
Jun 25th 2019, 12:56 |
rrd564 |
yes, i should provide an empty array |
# |
Jun 25th 2019, 12:51 |
madbbb |
the default strategy in 3.5 was to replace |
# |
Jun 25th 2019, 12:46 |
rrd564 |
maybe an empty array will do it |
# |
Jun 25th 2019, 12:46 |
rrd564 |
so i should try something else |
# |
Jun 25th 2019, 12:46 |
rrd564 |
Hm it seems that i would need replace startegy what is the default |
# |
Jun 25th 2019, 12:43 |
rrd564 |
Thank I have a look |
# |
Jun 25th 2019, 12:41 |
conehead |
Maybe have a look at the save strategy? https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-belongstomany-associations |
# |
Jun 25th 2019, 12:35 |
rrd564 |
When I modify a model with association and I want to remove a belongsToMany associated data, how do I do it? If I do not have model[0][associatedModel][_ids] in the POST array, than it keeps the original associated values |