0

I want to collect the variables from a link http://X1.com/track.php?name=john&invoiveid=222&amont=33&address=......&email=john@gmail.com First question can encode this link so the variables by encodes ? and how ? i want that track.php to collect those variable and re use it like :

$name
$invoiveid
$amont
$address
$email
nbk
  • 45,398
  • 8
  • 30
  • 47
bermejo
  • 1
  • 1

1 Answers1

0

use parse_url() and parse_str() for that.

<?php

$url = "https://example.com/test/1234?email=xyz4@test.com&testin=123";
$query_str = parse_url($url, PHP_URL_QUERY);
parse_str($query_str, $query_params);
print_r($query_params);
?>

result:

Array ( [email] => xyz4@test.com [testin] => 123 ) 

The result is an array

$query_params['email'] contains your email
nbk
  • 45,398
  • 8
  • 30
  • 47