Hi, Thanks for that code, I was excited about it but unfortunately it doesn't appear to do anything at all.
I uploaded a new product to see if it added it to Twitter and unfortunately, it didn't.
All I done was add this code to the update_product.php before the line zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
I changed the ******** with my Twitter password of course...... Any idea why it's not working? Am I missing a step somewhere?
PHP Code:
// BOF twitter feed
if ($action == 'insert_product')
{
$purl = zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id);
$tinyPurl = file_get_contents('http://tinyurl.com/api-create.php?url='.$purl);
function updateStatus($user, $password, $message)
{
$url = "https://twitter.com/statuses/update.xml";
$curl = curl_init($url);
$data = array('status'=>$message);
curl_setopt($curl, CURLOPT_USERPWD, $user.':'.$password);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
$result = @curl_exec($curl);
curl_close($curl);
return $result;
}
$message = STORE_NAME . ' has a new product. ' . $tinyPurl;
$user = 'limelites';
$password = '********';
updateStatus($user, $password, $message);
}
// EOF twitter feed