Including PHP arguments in... PHP Argument

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IWP506@gmail.com

    Including PHP arguments in... PHP Argument

    I know the subject is a bit confusing, but I really need to know if
    this is possible.

    I've got a php page. Let's call that a.php In a.php, I make a call to
    a webpage (b.php), with some arguments
    (http://domain.com/b.php?abcd=1234&efgh=5678).

    Can I do something like this:

    http://domain.com/a.php?argument= 'abcd=1234&efgh =5678', then from a.php
    use $_GET['argument'] to use in the creation of the URL to call b.php?

    In other words, I want to include a php argument in a php argument.

    Is this possible?

    I'd prefer not to use seperate variables (i.e.
    http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
    but if it's not possible, I guess I'll have to.

    Thanks,
    iwp506@gmail.co m

  • Domestos

    #2
    Re: Including PHP arguments in... PHP Argument

    [color=blue]
    >
    > I'd prefer not to use seperate variables (i.e.
    > http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
    > but if it's not possible, I guess I'll have to.
    >
    > Thanks,
    > iwp506@gmail.co m
    >[/color]

    What you are trying to do is called 'indirection' in other languages

    i.e.

    $varb='$a=20';
    execute $varb;
    echo $a;

    Result in '20' showing on the screen

    However I do not have enough knowledge to know if it is possible in php to
    do this.

    Sorry - googlin for 'php' and 'indirection' is throwing up a blank...

    it might be called somthing else in PHP.



    Comment

    • jay

      #3
      Re: Including PHP arguments in... PHP Argument

      try using urlencode() function on the second url. look it up on the
      php manual.

      ex:
      $argument = urlencode(abcd= $_GET['abcd']&efgh=$_GET['efgh']);

      then pass it to the second url

      http://domain.com/a.php?argument= $argument

      however you have to split the argument parameter to get the data.

      have used this before, got not much idea on its complications though.

      Comment

      • IWP506@gmail.com

        #4
        Re: Including PHP arguments in... PHP Argument

        OK, you answered half my question (thanks for the quick response),

        but now does anybody know if you can do something like
        http://www.domain.com/a.php?arg='$a=3 2&b=63'

        Comment

        • NC

          #5
          Re: Including PHP arguments in... PHP Argument

          IWP506@gmail.co m wrote:[color=blue]
          >
          > Can I do something like this:
          >
          > http://domain.com/a.php?argument= 'abcd=1234&efgh =5678', then from a.php
          > use $_GET['argument'] to use in the creation of the URL to call b.php?[/color]

          Yes. In scripts linking to a.php, you can write:

          $link = 'http://domain.com/a.php?argument= ' .
          urlencode('abcd =1234&efgh=5678 ');
          echo "<a href='$link'>Cl ick here for a.php...</a>";

          Then in a.php, you can write, for example:

          $b = file_get_conten ts('http://domain.com/b.php?' .
          urldecode($_GET['argument']));

          Cheers,
          NC

          Comment

          • Alvaro G Vicario

            #6
            Re: Including PHP arguments in... PHP Argument

            *** IWP506@gmail.co m wrote/escribió (29 Aug 2005 16:01:11 -0700):[color=blue]
            > http://domain.com/a.php?argument= 'abcd=1234&efgh =5678', then from a.php
            > use $_GET['argument'] to use in the creation of the URL to call b.php?
            >
            > In other words, I want to include a php argument in a php argument.
            >
            > Is this possible?
            >
            > I'd prefer not to use seperate variables (i.e.
            > http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
            > but if it's not possible, I guess I'll have to.[/color]



            I suppose the real files do not belong to the same website, otherwise it
            wouldn't make much sense to use HTTP to access a file that is reachable
            through the file system.


            --
            -- Álvaro G. Vicario - Burgos, Spain
            -- http://bits.demogracia.com - Mi sitio sobre programación web
            -- Don't e-mail me your questions, post them to the group
            --

            Comment

            • kerul4u

              #7
              Re: Including PHP arguments in... PHP Argument

              If Alvaro is saying is true for your case then its not possible..
              If Alvaro is not true then explain in simple way

              KERUL
              [ProDesignZ]

              Comment

              Working...