Search code examples
phpurlaweber

PHP Parse Command Line Results with Space in url string


I'm trying to parse the results from Aweber forms and unfortunately they pass the variables back with a space between the two words.

For example we want to capture a phone number and we have to use the field 'custom phone' instead of just 'phone' - its not possible to simply use the form field name 'phone' - I tried it - it doesn't parse into Aweber. Aweber can pass the variables from a form back to a PHP script that can then parse the values.

however the resulting url string that it passes back is

http://example.com/join.php?custom%20phone=123456789&email=etc...

I'm trying to extract the phone # from the command line string however it keeps returning a null

$phone = $_REQUEST['custom%20phone'];

or $phone = $_REQUEST['custom phone'];

doesn't contain any data. so i'm not accessing the request field. $_GET has the same issue.

Is there any way you extract the phone number into the $phone variable in PHP?

Thank you!


Solution

  • Use below code to get exactly what parameters are returned.

    echo "<pre>";
    print_r($_REQUEST); 
    

    I tried with the URL you gave and it returned

    Array
    (
        [custom_phone] => 123456789
        [email] => etc
    )