in reply to Re: Post Email address as CGI Parameter
in thread Post Email address as CGI Parameter

http://somedomain.com/cgi/register.cgi?login=$login&id=$user->{'id'}&e +mail=$user->{'email'}

In the above code, I am passing an argument email with some email address fetched from facebook profile. However, when I dump those vars, I am not getting the value of email.

Moreover, using Facebook::Graph::Query, we can get first_name, last_name, name, email by specifying them as fields

Replies are listed 'Best First'.
Re^3: Post Email address as CGI Parameter
by Anonymous Monk on Jan 06, 2015 at 19:59 UTC

    Where do you dump the vars, in register.cgi or in the script accessing the URL? Could you provide some sample code that reproduces the problem? I know what I mean. Why don't you?

    Taking a guess based on the information you've provided so far: are you perhaps looking for URI?

    use URI; my $uri=URI->new("http://somedomain.com/cgi/register.cgi"); $uri->query_form(login=>"somelogin", id=>12345, email=>'foo@bar.com'); print "$uri\n"; __END__ http://somedomain.com/cgi/register.cgi?login=somelogin&id=12345&email= +foo%40bar.com

    How to send a redirect with CGI is in its documentation, with sample code ("Generating a Redirection Header"). If you do that, take care not to print out a regular header() as well.

      Thank you for your inputs. However, I have nearly 10+ fields to be sent and I don't think it makes any sense to send it via URL. Here is the code I'm working on....

      #!/usr/bin/perl use strict; use HTTP::Request::Common; use CGI; use Facebook::Graph; use Data::Dumper; my $APP_ID = 'SOME_ID'; my $SECRET = 'SOME_SECRET_CODE'; my $POSTBACK_URL = "http://goto.this.domain/postback.pl"; my $fb = Facebook::Graph->new( app_id => $APP_ID, secret => $SECRET, postback => $POSTBACK_URL, ); my $q = new CGI; my $params = $q->Vars; my $code = $params->{'code'}; $fb->request_access_token($code); my $token = $fb->access_token; $fb->request_extended_access_token($token); my $user = $fb->fetch('me'); #register the facebook data into my site to create a new profile; my $login = $user->{'name'}; $login =~ s/\s//g; my $sarah_bownds = $fb->query->find($user->{'id'}) ->select_fields(qw(id name email)) ->request ->as_hashref; my $default_picture = $fb->picture($user->{'id'})->get_square->uri_as +_string; my %register = ( login => $login, firstname => $user->{'first_name'}, lastname => $user->{'last_name'}, email => $user->{'email'}, action => 'register', id => $user->{'id'}, ); print $q->redirect("http://goto.this.domain/cgi/register.cgi?login=$lo +gin&id=$user->{'id'}&email=$user->{'email'}&msg=201&args=$sarah_bownd +s");
        I don't know what my $sarah_bownds = $fb-> ... ->as_hashref is supposed to return, but if it is a hashref, I wouldn't put it into an URL like you did.
        First step to verify this would be to change the last line of your code to
        my $gotourl = "http://goto.this.domain/cgi/register.cgi?login=$login&i +d=$user->{'id'}&email=$user->{'email'}&msg=201&args=$sarah_bownds"; print "going to >>>$gotourl<<<\n"; print $q->redirect($gotourl);