$content = XN_Content::create('test_content', 'test only', 'this is just a test')
->my->add('testAttr1',10)
->my->add('testAttr2',1000)
->save();
https://appname.ning.com/xn/atom/1.0/content(type='test_content')
Tags:
Views: 2
$url = "https://" . $apphostname . "/xn/atom/1.0/content(type='test_content')";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_USERPWD, $appOwnerId.':'.$appOwnerPwd);
$result = curl_exec($curl);
$retcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$xml = new SimpleXMLElement($result);
foreach($xml->entry as $entry) {
// extract content id
preg_match('/\/[^\/]+$/', $entry->id, $matches);
$contentId = substr($matches[0], 1);
// if you want to delete content
XN_Content::delete($contentId);
// if you want to load the content object
$contentObject = XN_Content::load($contentId);
// you can access your attribute by using $contentObject->my->myAttribute
}
© 2026 Created by Ning Developer Admin.
Powered by