I feel like I'm losing my mind here with this error: I've been
hitting the
archives and google repeatedly, and not having any luck with a solution.
I'm trying to use sendAndLoad(..., ..., "POST") and having no luck. GET
seems to work, but not POST. I've been viewing the results with
FlashBug to
trace into FireBug, and the POST variables simply aren't there. I can
see
that the "sendAndLoad(...) is running, the page is being requested,
simply
with no post. PHP also says that $_POST is an empty Array. Tried
this from
multiple machines, multiple times.
This code originally worked until I started writing the sql queries
in the
PHP, but as you can see I've since removed them, so I'm guessing it had
nothing to do with that (and I can't see how it would). I originally
worried
that it might have something to do with the Serializer, but that doesn't
seem to be the problem.
I've snipped a bit of code out to clarify the problem, and hope it
doesn't
make this more difficult.
I'm sure this is something extremely simple/stupid on my part, but
I'm at
that point of beating my head repeatedly on the desk. Anyone able to
help
out?
ActionScript:
class LMSComm
{
private var _send_lv:LoadVars = undefined ;
private var _result_lv:LoadVars = undefined ;
private var _serializer:Serializer = undefined ;
public function LMSComm(config:ReportConfig)
{
_serializer = new Serializer() ;
}
public function getUserData(user_id:String, course_id:String):Void
{
var phpvars:Array = new Array()
phpvars["type"] = "userDataRequest" ;
phpvars["lms_user_id"] = user_id ;
phpvars["lms_course_id"] = course_id ;
var d = new Date() ;
phpvars["lms_no_cache"] = d.valueOf() ;
_send_lv = new LoadVars() ;
_result_lv = new LoadVars() ;
_result_lv.onLoad = Delegate.create(this,
notifyUserDataRecieved) ;
var serialized:String = _serializer.serialize(phpvars) ;
_send_lv.pos = "Bite Me" ;
_send_lv.courseData = "?"+serialized ;
Log.trace("CourseData Raw: " + _send_lv.courseData) ;
// this line runs (as seen in firebug) but is not sending any
POST data
_send_lv.sendAndLoad("userinfo.php", _result_lv, "POST") ;
}
public function notifyUserDataRecieved(success:Boolean):Void
{
if(success)
{
Log.trace("UserData Raw:" + _result_lv.userData) ;
var userData = _serializer.unserialize(_result_lv.userData) ;
//....
}
}
PHP Code
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
error_reporting(E_ALL);
$courseData = $_POST['courseData'];
if(get_magic_quotes_gpc())
{
$courseData = stripslashes($courseData) ;
}
$courseData = unserialize(urldecode($courseData));
print $courseData["type"];
print_r($_POST) ;
FIREBUG Console (results of Log.trace())
CourseData Raw:
?a:4:{s:12:"lms_no_cache";i:1176240332114;s:13:"lms_course_id";s:4:"C063";s:11:"lms_user_id";s:6:"JBRAND";s:4:"type";s:15:"userDataRequest";}
UserData Raw:undefined
PHP Output (response in firebug for userinfo.php)
<br />
<b>Notice</b>: Undefined index: courseData in
<b>/var/www/html/devlms/courses/test/quiz/userinfo.php
</b> on line <b>8</b><br />
Array
(
)
Firebug shows no POST variables.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com