Hi

First let me say that this is a great group with lots of willing
responders.  As a newbie to prototype, let me especially send out
kudos to Quleczka who was very patient with my form serialization/
processing needs.

Now another form processing problem dealing with cross server
requests.  I downloaded the following from the web (couple of
commented lines indicate what I changed/added; I named it
rawproxy.php) and also installed the cURL library to my php build last
evening:

<?php
if (!isset($HTTP_RAW_POST_DATA))   // this line and next were not in
download, but found a comment that said to add these when
$HTTP_RAW_POST_DATA was undefined, which it was
   $HTTP_RAW_POST_DATA = file_get_contents("php://input"); // added
this with above line
$post_data = $HTTP_RAW_POST_DATA; // this was here but undefined until
above added.
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($post_data);
$ch = curl_init( $_GET['url'] );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if ( strlen($post_data)>0 ){
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$response = curl_exec($ch);
if (curl_errno($ch)) {
    print curl_error($ch);
} else {
    curl_close($ch);
    print $response;
}
?>

I use following observe event all the time for forms even when no
validation is needed as in this case:

<script>
        $('formabc').observe ('submit',validatethis);
</script>

coupled with this no validation script:

<script language="javascript" type="text/javascript">
validatethis = function(evt)
{
        evt.stop();
        postIt('formabc');
}
</script>

and this form:

<form name="formabc" id="formabc" method="post" action="rawproxy.php?
url=http://dcmweb.mlp.com/machines/DisplayCabinetproxy.php";>

and postIt:

function postIt(theform) {
        var form = $(theform);
                var notice = $("mlprerresult");
                var content = $("MiddleContent");
                form.request({ onComplete: function(transport) {

                        notice.update('Your request completed successfully');
                        content.update(transport.responseText);

                }
});

}

No problem getting to the remote server (dcmweb), nor coming back and
displaying transport content - though content itself is in error
because of numerous errors trying to bring in posted data (as normal
way of $x=$_POST['field']; - which is probably one form of problem) -
like (from error_log):

[client 10.77.11.11] PHP Notice:  Undefined index:  floorfield in /dat/
apacheconf/dcmweb/htdocs/machines/DisplayCabinetproxy.php on line 7

from rawproxy content of $post_data = :

cntry-city-bldg=5&floorfield=08&rowfield=03&cabfield=06 (looks good
from point of view of names and values))

the same output appears if I use same statements in
DisplayCabinetproxy and print $post_data; i.e.:
(if (!isset($HTTP_RAW_POST_DATA))
   $HTTP_RAW_POST_DATA = file_get_contents("php://input");
$post_data = $HTTP_RAW_POST_DATA;)

if, however, I use print_r($_POST), I get (in rawproxy):

Array ( [cntry-city-bldg] => 5 [floorfield] => 08 [rowfield] => 03
[cabfield] => 06 ),

but in DisplayCabinetproxy, I get an empty array.

Ok, I see that the post data is not getting to DisplayCabinetproxy,
but not sure why; nor what difference is or what I need to do to get
post data safely to my target or else access what is getting there
in .

Thanks in advance for going through this long post; hope I have not
been too gregarious...

Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to