By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

Formatting Output not from PHP script

P: n/a
Hello,

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

Example:

<form method=POST action=www.myurl.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
Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <89**************************@posting.google.com >, Robert wrote:
Hello,

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

Example:

<form method=POST action=www.myurl.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)


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).

Jul 16 '05 #2

P: n/a
Martin Wickman <wi*****@hotbrev.com> wrote in message news:<sl********************@babar.tuffmusik.nu>.. .
In article <89**************************@posting.google.com >, Robert wrote:
Hello,

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

Example:

<form method=POST action=www.myurl.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)


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).


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_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $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
Jul 16 '05 #3

P: n/a
ha******@yahoo.com (Robert) wrote:
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.


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.
Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.