Small piece of php needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oliver  Marshall

    Small piece of php needed

    Hi chaps,

    I just need a widget of php if anyone has somethign similar to hand.

    I need to create a .php file that will take an input (&type=xxx or
    yyy), run a piece of javascript in the browser (its the google
    analytics javascript which i have here) and then send the user to
    download either Install1.exe or Install2.exe depending on the value of
    'type'.

    At the mo, i have two links that link straight to one of two .exe
    files. However, to make analysis easier, i want to have those links go
    to a php page, which will run the javascript in the browser, thereby
    getting google to log the download of the file, and then 'redirect'
    the browser to download the correct file, so it appears seemlessly.

    Can anyone help ?

    Olly
    --
    Managed online backup services
    G2 Support


    Get a free trial today


  • Jerry Stuckle

    #2
    Re: Small piece of php needed

    Oliver Marshall wrote:
    Hi chaps,
    >
    I just need a widget of php if anyone has somethign similar to hand.
    >
    I need to create a .php file that will take an input (&type=xxx or
    yyy), run a piece of javascript in the browser (its the google
    analytics javascript which i have here) and then send the user to
    download either Install1.exe or Install2.exe depending on the value of
    'type'.
    >
    You can't use PHP to "run a piece of javascript on the browser". PHP is
    server side and cannot cause anything to run on the client machine. The
    best you can do is use PHP to generate Javascript code when must then be
    run on the browser as any javascript would be.

    And you won't be able to send them to the download page in addition to
    running the javascript. You can either send them the javascript code or
    you can send them to the download page - not both.
    At the mo, i have two links that link straight to one of two .exe
    files. However, to make analysis easier, i want to have those links go
    to a php page, which will run the javascript in the browser, thereby
    getting google to log the download of the file, and then 'redirect'
    the browser to download the correct file, so it appears seemlessly.
    >
    Can anyone help ?
    >
    Maybe you can generate some additional JS code to do the redirect, but
    it still won't be transparent.

    Or you can implement your own logging mechanism in PHP and completely
    forget about getting Google to do it for you.
    Olly
    --
    Managed online backup services
    G2 Support

    >
    Get a free trial today

    >

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Oliver  Marshall

      #3
      Re: Small piece of php needed

      Surely you can use php to render a page containg the javascript code,
      and then include a javascript redirect to the .exe download required
      by the specified variable ?


      On Feb 25, 2:24 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      Oliver Marshall wrote:
      Hi chaps,
      >
      I just need a widget of php if anyone has somethign similar to hand.
      >
      I need to create a .php file that will take an input (&type=xxx or
      yyy), run a piece of javascript in the browser (its the google
      analytics javascript which i have here) and then send the user to
      download either Install1.exe or Install2.exe depending on the value of
      'type'.
      >
      You can't use PHP to "run a piece of javascript on the browser". PHP is
      server side and cannot cause anything to run on the client machine. The
      best you can do is use PHP to generate Javascript code when must then be
      run on the browser as any javascript would be.
      >
      And you won't be able to send them to the download page in addition to
      running the javascript. You can either send them the javascript code or
      you can send them to the download page - not both.
      >
      At the mo, i have two links that link straight to one of two .exe
      files. However, to make analysis easier, i want to have those links go
      to a php page, which will run the javascript in the browser, thereby
      getting google to log the download of the file, and then 'redirect'
      the browser to download the correct file, so it appears seemlessly.
      >
      Can anyone help ?
      >
      Maybe you can generate some additional JS code to do the redirect, but
      it still won't be transparent.
      >
      Or you can implement your own logging mechanism in PHP and completely
      forget about getting Google to do it for you.
      >
      Olly
      --
      Managed online backup services
      G2 Support
      www.g2support.com/backups
      >
      Get a free trial today
      www.g2support.com/downloads
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===

      Comment

      • Jerry Stuckle

        #4
        Re: Small piece of php needed

        Oliver Marshall wrote:
        On Feb 25, 2:24 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >Oliver Marshall wrote:
        >>Hi chaps,
        >>I just need a widget of php if anyone has somethign similar to hand.
        >>I need to create a .php file that will take an input (&type=xxx or
        >>yyy), run a piece of javascript in the browser (its the google
        >>analytics javascript which i have here) and then send the user to
        >>download either Install1.exe or Install2.exe depending on the value of
        >>'type'.
        >You can't use PHP to "run a piece of javascript on the browser". PHP is
        >server side and cannot cause anything to run on the client machine. The
        >best you can do is use PHP to generate Javascript code when must then be
        >run on the browser as any javascript would be.
        >>
        >And you won't be able to send them to the download page in addition to
        >running the javascript. You can either send them the javascript code or
        >you can send them to the download page - not both.
        >>
        >>At the mo, i have two links that link straight to one of two .exe
        >>files. However, to make analysis easier, i want to have those links go
        >>to a php page, which will run the javascript in the browser, thereby
        >>getting google to log the download of the file, and then 'redirect'
        >>the browser to download the correct file, so it appears seemlessly.
        >>Can anyone help ?
        >Maybe you can generate some additional JS code to do the redirect, but
        >it still won't be transparent.
        >>
        >Or you can implement your own logging mechanism in PHP and completely
        >forget about getting Google to do it for you.
        >>
        >>Olly
        >>--
        >>Managed online backup services
        >>G2 Support
        >>www.g2support.com/backups
        >>Get a free trial today
        >>www.g2support.com/downloads
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        >
        Surely you can use php to render a page containg the javascript code,
        and then include a javascript redirect to the .exe download required
        by the specified variable ?
        >
        >
        (Top posting fixed)

        You could do that. But the only PHP you would need for that would be to
        insert a file name into the javascript, and perhaps insert the name of
        the download page in the javascript redirect.

        One or two echo statements - nothing more.

        P.S. Please don't top post. Thanks.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        Working...