I am sending information to my url. As far as I can tell, I am doing it properly. My problem is two-fold: the post/get variables don't seem to be registering, and, (although a less concerning issue) I am getting strict standards errors from the myspace library. I am working on firefox; I downloaded the api yesterday; I am using opensocial 0.8.
The following (in order) is my output, php file, after that is my canvas page file.
Any suggestions would be appreciated and thank you in advance.
canvas page output:
Strict Standards: Assigning the return value of new by reference is deprecated in /{secret}/myspace/client/lib/base/BaseAPI.php on line 75
Strict Standards: Assigning the return value of new by reference is deprecated in /{secret}/myspace/client/lib/base/BaseAPI.php on line 140
Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/php/HTTP/Request.php on line 412
Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/php/HTTP/Request.php on line 736
Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/php/HTTP/Request.php on line 749
Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/php/HTTP/Request.php on line 794
Strict Standards: Redefining already defined constructor for class Net_URL in /usr/share/php/Net/URL.php on line 124
Notice: Undefined variable: myspaceKey in /{secret}//myspace/www/response.php on line 6
Notice: Undefined variable: myspaceSecret in /{secret}/myspace/www/response.php on line 6
Notice: Undefined index: viewer_id in /{secret}/myspace/www/response.php on line 8
Notice: Undefined index: owner_id in /{secret}/myspace/www/response.php on line 10
Notice: Undefined index: viewer_id in /{secret}/myspace/www/response.php on line 12
php of response.php:
<?php
//require myspace library
//set secret and key
$client = new MySpaceAPI($myspaceKey, $myspaceSecret);
echo $_POST['viewer_id'];
echo $_POST['owner_id'];
echo $_GET['viewer_id'];
echo $_POST['owner_id'];
print_r($_REQUEST);
print_r($_GET);
print_r($_POST);
?>
canvas page js:
<iFrame id="AppBody" src="" scrolling="no" style="width: 960px; min-height:1000px; overflow:auto; float:left;"></iFrame>
<script type="text/javascript">
// Global variables needed for the application
var url="/{secret}/myspace/www/response.php";
function init() {
// create the opensocial.DataRequest object.
var request = opensocial.newDataRequest();
// create a list of Person fields to fetch,
var fields = [opensocial.Person.Field.ID];
// add the supported fields to the parameter list.
var params = new Object();
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = fields;
// add the fetch person request to the queue.
request.add(request.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, params), "the_viewer");
request.add(request.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER, params), "the_owner");
// start executing the requests, call back into got_init when done.
var data = request.send(get_user_data);
makeRequest(data);
}
function get_user_data(response) {
var parse_person = true;
if(parse_person) {
// get the opensocial.Person object from the other opensocial.ResponseItem and save it to a global variable.
person = response.get("the_viewer").getData();
owner = response.get("the_owner").getData();
//get viewerid and ownerid and parse string
var viewerId = person.getId().substr(12, person.getId().length);
var ownerId = owner.getId().substr(12, person.getId().length);
var idData = {};
idData['viewer_id'] = viewerId;
idData['owner_id'] = ownerId;
return idData;
}
}
function makeRequest(postdata) {
var params = {};
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
if (postdata) {
params[gadgets.io.RequestParameters.POST_DATA] = gadgets.io.encodeValues(postdata);
}
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
gadgets.io.makeRequest(url, response, params);
}
function WriteBody(html) {
document.getElementById("AppBody").src = url;
document.getElementById("AppBody").innerHTML = html;
}
function doMRPost() {
var params = {};
var postdata = {};
for(a=0; a<document.ApForm.elements.length; a++) {
postdata[document.ApForm().name] = document.ApForm().value;
}
makeRequest(postdata);
}
function response(mrResponse) {
WriteBody(mrResponse.text);
}
init();
</script>