Troels Johannesen
Troels Johannesen

Reputation: 725

Get Value from URL - GET Request

Hello I'm trying to get specific values out of my url that looks like this:

http://test.com/search.php?go&s=20&cacheKey=-5d36c171:14b930086c4:-561&cacheLocation=10.186.170.204:7300&customerSessionId=0ABAAACC-36C1-7191-4B92-30086C490817

What I have tried is e.g this:

$url .= '&cacheKey=' . strval($_GET['$cacheKey']);

But the value is not parsed correctly - What am I doing wrong ?

When I var_dump the $_GET I get the array out with all the values:

array(5) { ["go"]=> string(0) "" ["s"]=> string(2) "20" ["cacheKey"]=> string(26) "-5d36c171:14b930086c4:-561" ["cacheLocation"]=> string(19) "10.186.170.204:7300" ["customerSessionId"]=> string(36) "0ABAAACC-36C1-7191-4B92-30086C490817" }

Upvotes: 0

Views: 68

Answers (2)

Pawan Kartik
Pawan Kartik

Reputation: 34

Remove $ from CacheKey.

$CacheKey is different from CacheKey.

Upvotes: 0

stwalkerster
stwalkerster

Reputation: 1828

Try using:

$url .= '&cacheKey=' . strval($_GET['cacheKey']);

Note the missing $ in the array index.

Upvotes: 2

Related Questions