Jump to content
Larry Ullman's Book Forums

Simple Call From Windowed Application To Php


 Share

Recommended Posts

Hi Larry,

 

I feel that I am being a bit of a pest with this one but it is driving me crazy!

 

I have the simplest of calls to a small PHP routine which returns a simple string. Here's the PHP code:

 

<?php

if ($_POST['dirIn']) {

$dirin = $_POST['dirIn'];

echo "$dirin";

}

else {

echo "Unidentified request";

}

?>

 

The (part of) flex code is:

 

<fx:Declarations>

 

<s:HTTPService id="service"

url="

http://localhost/Resizer_Flex_PHP/service.php"

useProxy="

false"

method="

POST"

resultFormat="

text"

fault="service_faultHandler(event)"

result="service_resultHandler(event)"

>

 

<s:request>

 

<dirIn>{displayDirin.text}

 

</dirIn>

 

</s:request>

 

</s:HTTPService>

 

</fx:Declarations>

 

and...

 

protected function service_resultHandler(event:ResultEvent):void

{

processingStatus.text = event.result.value;

}

 

I am experiencing two problems - firstly the request dirIn bind won't bind the data which is in a form element (I checked, and a string with the value I want is there). How else can I pass the data to the PHP script?

 

Secondly, the result handler seems to work OK - via debug I can see the value of "Unidentified request" in the event.result from the debugger variables with the status code being 200. But I get an error message when I try to put that into the form text area.

 

These are probably obvious and simple problems but I can't figure out the corrections.

 

Any assistance will be mightily appreciated.

 

Thanks in anticipation, Necuima.

Link to comment
Share on other sites

Hi again, Larry,

 

After more googling and quite a bit of trial and error, I have solved the two problems listed above.

 

I made a new variable to contain the native path of the input directory and declared it to be bindable. Then in the HTTPService I changed the parameter to be that variable's name. That works A-OK now.

 

In the result handler, i just type-casted the event.result to be a string, and now that works A-OK too.

 

The learning continues...

 

Cheers from Oz, Necuima.

Link to comment
Share on other sites

 Share

×
×
  • Create New...