# |
Apr 26th 2019, 09:32 |
asdfgh |
however now i am testing in local server |
# |
Apr 26th 2019, 09:32 |
asdfgh |
thanks |
# |
Apr 26th 2019, 09:32 |
asdfgh |
i will concatenate host and port |
# |
Apr 26th 2019, 09:32 |
asdfgh |
thanks |
# |
Apr 26th 2019, 09:32 |
asdfgh |
ok |
# |
Apr 26th 2019, 09:32 |
asdfgh |
neon1024 ok that was my doubt...i thought there was a method to get all the info with the port too |
# |
Apr 26th 2019, 09:31 |
neon1024 |
You can use `$this->here` but it’s being deprecated, so implementing the PSR7 interface is preferred |
# |
Apr 26th 2019, 09:31 |
neon1024 |
Yes |
# |
Apr 26th 2019, 09:31 |
asdfgh |
neon1024 pardon i do not follow you, should i "compose" the url by getting getHost() and thne getPort() ? |
# |
Apr 26th 2019, 09:31 |
neon1024 |
`->setPatterns(['code' => '[\w-\/]+'])` ? |
# |
Apr 26th 2019, 09:30 |
neon1024 |
Could the pattern not be used to match a `/` ? |
# |
Apr 26th 2019, 09:30 |
neon1024 |
Although in that instance I think `**` might include the `/stock` part :thinking_face: |
# |
Apr 26th 2019, 09:29 |
neon1024 |
Might be worth checking the book, as I’m not 100% certain |
# |
Apr 26th 2019, 09:29 |
neon1024 |
@patox44 I presumed in the url `->connect('/dataset/**/stock` |
# |
Apr 26th 2019, 09:28 |
neon1024 |
I don’t know why you would do that |
# |
Apr 26th 2019, 09:28 |
neon1024 |
No. |
# |
Apr 26th 2019, 09:28 |
asdfgh |
pardon withUri() |
# |
Apr 26th 2019, 09:28 |
asdfgh |
neon1024 yes so i should get that object and then pass to withHOst ? |
# |
Apr 26th 2019, 09:28 |
neon1024 |
Which has methods to get all the parts of the url, use those is my suggestion |
# |
Apr 26th 2019, 09:28 |
patox44 |
do you mean something like this? |
# |
Apr 26th 2019, 09:28 |
neon1024 |
PSR7 encompasses a uri in a class instance |
# |
Apr 26th 2019, 09:27 |
neon1024 |
This is the bit you’re interested in |
# |
Apr 26th 2019, 09:27 |
neon1024 |
@return \Psr\Http\Message\UriInterface Returns a UriInterface instance 2307: * representing the URI of the request. |
# |
Apr 26th 2019, 09:27 |
asdfgh |
i can compose the url for sure but i asked if there is a method without reinvent it |
# |
Apr 26th 2019, 09:27 |
asdfgh |
but sounds "stupid" to clone the object again |
# |
Apr 26th 2019, 09:26 |
asdfgh |
neon1024 i see the port is only mentioned here: https://api.cakephp.org/3.7/source-class-Cake.Http.ServerRequest.html#2324 |
# |
Apr 26th 2019, 09:25 |
neon1024 |
@patox44 Don’t you need a route with `**` in to pass slashes? |
# |
Apr 26th 2019, 09:25 |
neon1024 |
@asdfgh I won’t give you the code, you can work it out from here. |
# |
Apr 26th 2019, 09:23 |
patox44 |
how can I send '/' as param in url? I tried via `encodeURIComponent` in js, but it not works. I got error Object is not found `/dataset/PWW-06%20RADIATOR%20L%2FL/stock` |
# |
Apr 26th 2019, 09:21 |
asdfgh |
neon1024 ^ |
# |
Apr 26th 2019, 09:18 |
asdfgh |
i need 'http://localhost:7895/' |
# |
Apr 26th 2019, 09:18 |
asdfgh |
neon no wiat if i print that url i see 'http://localhost:7895/agents/dashboard' |
# |
Apr 26th 2019, 09:17 |
neon1024 |
You can go and check the PSR7 standard if you want to |
# |
Apr 26th 2019, 09:17 |
neon1024 |
As I said, it’s all there |
# |
Apr 26th 2019, 09:16 |
asdfgh |
(and WITH the port if exists) |
# |
Apr 26th 2019, 09:16 |
asdfgh |
without the path |
# |
Apr 26th 2019, 09:16 |
asdfgh |
neon1024 what about if i only need the url of the website? |
# |
Apr 26th 2019, 09:16 |
asdfgh |
thanks!!! |
# |
Apr 26th 2019, 09:15 |
neon1024 |
Will contain all the data you need |
# |
Apr 26th 2019, 09:15 |
neon1024 |
`var_dump($this->getRequest()->getUri()` |
# |
Apr 26th 2019, 09:14 |
asdfgh |
i need the entire path |