Hi, I am very new to drupal and flex. i am learning drupal and flex for the past 2 months. now i know some concepts in drupal.
Now I am developing desktop application for drupal in flex(Air application). i am using amfphp to call the remoteobject(drupal database).

Now I am able to connect mysql database from flex through amfphp.
I can retrieve data from mysql and i can store data into the database. For the drupal desktop application, i can access the drupal database from my desktop application directly through amfphp(i.e) i am able to access the drupal database through an external file(php file which has sql to access database). But i want to call the drupal modules file and includes file from the frontend application(flex) through the remote file.
Say for example, i need to call the bootstrap.inc file with the argument " DRUPAL_BOOTSTRAP_FULL" from my external php file through the remoteobject(amfphp). Now i dont know how to call this file from flex remoteobject. I dont konw the way to continue the progress further.
Anyone suggest me how can i do this and how can i acheive this..... Thank u

Note : i am not using services module and amfphp module for this. i am only using amfphp

Comments

sagar.sijju’s picture

Hi vanithapg,

I am very new to flex. i have to develop a website in flex and drupal(drupal as backend). can you please send me the process.

my mail id : sagar.sijju@gmail.com

Thanks in advance.

vanithapg’s picture

hi,

i can call a php file to store node in drupal database through amfphp in flex... the php code is as follows

class CatalogService {
	function insertCourse($node) {
		$dbh = mysql_connect('localhost', 'vanitha', 'vanitha');
		$type = $node['type'];
		$title = $node['title'];
		$uid = $node['uid'];
		$vid ="33";
		$sql = 'INSERT INTO `drupaldb`.`node` (`type`, `title`,`uid`,`vid`) VALUES ("'.$type.'","'.$title.'","'.$uid.'","44")';		
		$result = mysql_query($sql, $dbh);
		
	}
}

the flex code will be as,




private function insertCourseResult():void {
myDG.dataProvider = catalogService.insertCourse.lastResult;
}

private function doInsert():void {
var course:Object = new Object();
course.uid = tid.text
course.type = ttype.text;
course.title = ttitle.text;
catalogService.insertCourse.send(course);
}

With this code, i can call the remote php file(CourseCatalog.php) which inturn call the drupal database and store the node value.
But, i am in need to call the drupal node function(node_save function)from this php file.
For that i included the following line in the remote php file as follows,

echo "hi";
chdir('C:\Program Files\EasyPHP 3.0\www\drupal');
require_once 'C:\Program Files\EasyPHP 3.0\www\drupal\includes\bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
class CatalogService {
function insertCourse() {
   	$node->uid = "1";
		$node->title="haifrmphp";
		$node->type="page";
		$node->submit = "save";
		node_save($node);
}
}


If i run this file directly in the browser, it will call the required function and the node data is stored in the drupal database.But if i call this file from flex amfphp , it will not work...
if i remove the line drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); , then i can able to cal from flex but it doesnt give output...

can anyone help me!!!
Thank U