Pulling the title of a wall post - api

just wondering if there is a way, using the API, to pull out the post title and desc separately? Essentially I would like this:
$post['author'] = $p['from'];
$post['title'] = $p['?'];
$post['content'] = $p['?'];
thanks
edit. I would also be happy with pulling just the title of a new post...
edit2. my mistake, there is no title in facebook posts. my coffee finally kicked in and my ignorance was revealed to me.

Try this http://www.wescutshall.com/2011/12/getting-facebook-user-data-with-php/
As you can see, you need some special permission from FB to get the data you need.
After that you can use their api, as described in the url before, to get your data.
EDIT:
Here you can see wich info you can get of a person:
http://developers.facebook.com/docs/reference/login/extended-profile-properties/
And here, wich you can get of a message (user_status):
http://developers.facebook.com/docs/reference/fql/location_post/
after you have this you can pull out the information using:
$config = array(
‘appId’ => FBAPPID,
‘secret’ => FBAPPSECRET,
);
$facebook = new Facebook($config);
$fbuserid = $facebook->getUser();
$params = array(
“scope” => “user_status”,
“redirect_uri” => “http://www.yoursite.com/”
);
$loginurl = $facebook->getLoginUrl($params);

Related

PHP SOAP pass parameters a:DeserializationFailed error

I ma trying to pass values like below for $valueTicket
$default_value = array(
'ticket' => $valueTicket,
'customercode' => 'abcdefgh'
);
shows error a:DeserializationFailed
while same time if i pass static value then works fine like below example
$default_value = array(
'ticket' => 'zyx12-3iuyf-njfg-sdj-shjs',
'customercode' => 'abcdefgh'
);
can anyone know whats the problem please assist.
if anyone need any information regarding my issue then ask me.

phpbb 3.2.x user_add including custom Profile field

This has been driving me nuts for 2 days and I can't find an answer anywhere on Google so would really appreciate a little help..
I have a custom registration form on my website, which sends the data to a fairly standard PHPBB3 user_add process as follows:
$user_row = array(
'username' => request_var('createUsername',''),
'user_password' => phpbb_hash(request_var('createPassword','')),
'user_email' => request_var('createEmail',''),
'group_id' => '2',
'user_timezone' => '1.00',
// 'user_dst' => '0',
'user_lang' => 'en',
'user_type' => $user_type,
'user_actkey' => $user_actkey,
'user_ip' => $user->ip,
'user_regdate' => time(),
'user_inactive_reason' => $user_inactive_reason,
'user_inactive_time' => $user_inactive_time,
);
// Register user...
$user_id = user_add($user_row, $cp_data);
// If creating the user failed, display an error
if ($user_id === false)
{
trigger_error('NO_USER', E_USER_ERROR);
}
That works fine and I'm happy with it, however, I have created a custom profile field in the Admin Control Panel called 'ea_real_name' which I want to hold the user's real name. This corresponds to a field on the registration form called 'createRealName' (sent through as $_POST['createRealName'])
I know that user_add takes an optional field called 'cp_data', but I can't for the life of me work out how to format this data... Should it be an array (something like 'ea_real_name' => request_var('createRealName','') or something else?
PHPBB's wiki for the field is empty (https://wiki.phpbb.com/Custom_profile::submit_cp_field) so not much help...
Thanks! :-)
I was right in my assumption! It's an array with the field name prefixed by pf_.
Finally found an answer here: https://www.phpbb.com/community/viewtopic.php?f=71&t=1638905
$cp_data = array(
'pf_ea_real_name' => request_var('createRealName','')
);
Is the correct way to do it...

Shopify API Updating Fulfillments

I am writing a private app in Shopify with PHP. I have been able to get most of the other access to the json data, however, I am having trouble with Fulfillments - specifically updating a single line-item.
I am using the api-skeleton (phpish)?
Here is my code (the process as described seems so simple):
$orderid = "1350520065";
$itemid = "2338134657";
$quantity = 1;
$arguments = array(
'fulfillment' => array(
'tracking_number' => null,
'notify_customer' => true,
'line_items' => array(array('id' => $itemid, 'quantity' => 1))
)
);
$response = $shopify('POST /admin/orders/' . $orderid . '/fulfillments.json', $arguments);
I am getting [line_items] => Required parameter missing or invalid.
Any help would be appreciated.
Skip the line items unless you are doing a partial fulfillment. If you are, then obviously you need a quantity. You forgot that it seems, hence your error of missing parameter.
Add a header 'Content-Type:application/json' to your POST. That worked for me.

cakephp url not retrieving data

hi all when clicking the link on my page its not carrying the id from the template when going to the view page, so when the sql queries the database it is querying this
SELECT `Field`.`name`
FROM `pra`.`fields` AS `Field`
LEFT JOIN `pra`.`templates` AS `Template` ON (
`Field`.`template_id` = `Template`.`id`)
WHERE `template`.`id` IS NULL
the database says id should be = 2
here is the code for the view function
$fields = $this->Field->find('all',
array('fields'=>array('name','template_id'),
'conditions' => array('template_id' => $this->Auth->user('template.id'))));
$this->set('field', $fields);
updated code, the template_id still equals null
when hardcoded it works correctly, there is a problem with this line $this->Auth->user
You can try with the following code:
$fields = $this->Field->find('all',
array('fields'=>array('name'),
'conditions' => array('Field.template_id' => $this->Auth->user('template_id'))
)
);
$this->set('field', $fields);
Please be sure there must have any template_id value should be there for the current logged in user.
Kindly ask if it not worked for you.
Check the result of the find call, by doing a debug:
debug($fields);
This will show you the returned data from the query. You can add this to the end of your action method.
If the results are empty, double check the values that are stored in the session Auth key. You can do this by dumping out the session with debug($_SESSION) or use the CakePHP DebugKit. The Debug Kit offers you a small toolbar at the top right of the screen and lets you view session information and such.
function view($name){
$this->set('title_for_layout', 'Create Template');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.jpg');
$this->layout='home_layout';
$fields = $this->Template->Field->find('list',array(
'fields'=> array('name'),
'conditions' => array(
'template_id'=> $name)));
$this->set('field', $fields);
}
it wasn't passing the param's value

zend retriving tag list

I have some problem with zend. Here it is. I'm going to make some kind of articles db, which containt some info. Every article is marked with 1 or more tags (like WordPress).
I have a controller (let it be index) and action (also index).
All I need is to get articles and tags, associated with it, when user goes to site/index/index.
I have 3 tables:
articles(idarticles, title..)
tags(idtags, title)
tagList(idarticles, idtags).
How can I read tags, associated with article?
Zend's MVC doesn't actually include a model, however, the quickstart guide outlines creating a model.
The simplest way (not necessarily the best way), is to setup the connection in your application.ini, or setup the adapter like this (see the Zend_Db_Adapter docs):
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => '127.0.0.1',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname' => 'test'
));
Then use SQL to select your data.
//all articles
$articles = $db->query('SELECT * FROM articles');
//a article's tags
$tags = $db->query('SELECT * FROM tagList JOIN tags ON
(tagList.idtag = tags.idtags) WHERE idarticles = ?', $idarticles);
This is also taged for Zend_Db_Table, to use that to access the data, first setup a default adapter (or again, use application.ini):
Zend_Db_Table::setDefaultAdapter($dbAdapter);
Then get objects for you tables like this:
$ariclesTable = new Zend_Db_Table('articles');
To get all the articles:
$articles = $articlesTable->fetchAll();
To get an article's tags (little more complex here, using a Zend_Db_Table_Select as recommended):
$select = $tagsTable->select();
//3rd argument must be empty array, so no joined columns are selected
$select->join('tagList', 'tagList.idtag = tags.idtags', array());
$select->where('tagList.idarticles = ?', $idarticles);
$tags = tagsTable->fetchAll($select);