Formatting Output not from PHP script

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

    #1

    Formatting Output not from PHP script

    Hello,

    I am trying to get output formatted from a non-php script that I post
    to.

    Example:

    <form method=POST action=www.myur l.com/ColdFusion.cfm>
    bla bla bla
    </form>

    When this is ran with my strings inserted from a php script it returns
    THAT forms results to the browser. How do I grab and manipulate that
    data BEFORE it hits the browser? (eg, change the output from screen to
    my php script and do something with it)

    The cfm script will not change, and I do not have access to it. I
    also do not want to use cfm for this, as it is a PHP SDK for others
    with PHP to tap into that script without changing to cfm, or adding it
    to their server.

    Thanks in advance,

    Robert
  • Martin Wickman

    #2
    Re: Formatting Output not from PHP script

    In article <895be58e.03081 51606.607ccb50@ posting.google. com>, Robert wrote:[color=blue]
    > Hello,
    >
    > I am trying to get output formatted from a non-php script that I post
    > to.
    >
    > Example:
    >
    ><form method=POST action=www.myur l.com/ColdFusion.cfm>
    > bla bla bla
    ></form>
    >
    > When this is ran with my strings inserted from a php script it returns
    > THAT forms results to the browser. How do I grab and manipulate that
    > data BEFORE it hits the browser? (eg, change the output from screen to
    > my php script and do something with it)[/color]

    You need change the <form> tag so it's action points to your
    php-wrapper which does the actual POST request to
    www.myurl.com/ColdFusion.cfm and then manipulates it and finally
    prints it. Look at php-curl (http://se.php.net/manual/en/ref.curl.php).

    Comment

    • Robert

      #3
      Re: Formatting Output not from PHP script

      Martin Wickman <wizball@hotbre v.com> wrote in message news:<slrnbjsrs 1.s71.wizball@b abar.tuffmusik. nu>...[color=blue]
      > In article <895be58e.03081 51606.607ccb50@ posting.google. com>, Robert wrote:[color=green]
      > > Hello,
      > >
      > > I am trying to get output formatted from a non-php script that I post
      > > to.
      > >
      > > Example:
      > >
      > ><form method=POST action=www.myur l.com/ColdFusion.cfm>
      > > bla bla bla
      > ></form>
      > >
      > > When this is ran with my strings inserted from a php script it returns
      > > THAT forms results to the browser. How do I grab and manipulate that
      > > data BEFORE it hits the browser? (eg, change the output from screen to
      > > my php script and do something with it)[/color]
      >
      > You need change the <form> tag so it's action points to your
      > php-wrapper which does the actual POST request to
      > www.myurl.com/ColdFusion.cfm and then manipulates it and finally
      > prints it. Look at php-curl (http://se.php.net/manual/en/ref.curl.php).[/color]

      Thanks! After digging below seemed correct, if there is a better way
      let me know:

      ==Code Start==

      ob_start();
      $ch = curl_init();
      curl_setopt($ch , CURLOPT_URL, "http://10.0.0.225:801/Coldfusion.cfm" );
      curl_setopt($ch , CURLOPT_FOLLOWL OCATION, 1);
      curl_setopt($ch , CURLOPT_POST, 1);
      curl_setopt($ch , CURLOPT_POSTFIE LDS, $poststring);
      curl_exec($ch);
      curl_close($ch) ;
      $result = ob_get_contents ();
      ob_end_clean();

      $output = explode(",", $result);

      ==Code End==

      Ignore the URL, it's correct for what I'm working with, I thought
      using a "$result = curl_exec($ch)" would give me the output, but it
      only returns a "1 or 0" for true and false. Wish that there was more
      doc's for curl either on their website or php.net You kinda have to
      dig around a little to get going.

      Thanks Again!
      Robert

      NOTE: Reply with code added to help others when they do the right
      thing SEARCH FIRST!

      Keywords: output, buffer, ob_start, curl, stdout, wrapper, redirect

      Comment

      • Daniel Stenberg

        #4
        Re: Formatting Output not from PHP script

        hackajar@yahoo. com (Robert) wrote:
        [color=blue]
        > Wish that there was more
        > doc's for curl either on their website or php.net You kinda have to
        > dig around a little to get going.[/color]

        I feel the need to break in here and put things in perspective.

        curl is very thoroughly documented, and so is libcurl (at least I
        consider them so). You'll find heaps of documentation on the curl web
        site and in every curl release source archive.

        PHP/CURL is a libcurl binding that is written to be used by PHP
        programs. This is not as thoroughly documented (especially on the curl
        web site), and you will not find much docs for it on the curl web site
        as I've always considered that the responsibility of the PHP/CURL
        authors and users.

        There are almost 20 different bindings for libcurl, and the PHP/CURL
        module is just one of them.

        The CURL module for PHP seems to be fairly frequently used, but very
        rarely completely understood and hardly documented. This is open
        source, anyone who feels a lack could dive and help.

        / Daniel - curl and libcurl author.

        Comment

        Working...