9, February 2010

Error: Post an RSS feed to Twitter - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Error: Post an RSS feed to Twitter
« previous next »
Pages: [1] Print

Author Topic: Error: Post an RSS feed to Twitter  (Read 874 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Jul 02, 2009, 02:15:32 am »

My feed is located here at pbem2 dot com filename is xml.php (I can't post the link because I don't have 20 posts.)

Here's the error I get:

Quote
Warning: Invalid argument supplied for foreach() in /home/mydomain/public_html/twitter.php on line 37

My feed validates, so that's not a problem. It works with feedburner, and with twitterfeed.

Line 37 in the code is

Code:
foreach( $feed->channel->item as $item ){

Any ideas?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5642
45485 credits
Members referred : 3



« Reply #1 on: Jul 02, 2009, 04:19:29 pm »

Propably it is not an rss feed. Look at the xml tree and replace $feed->channel->item with the correct tree.

You can post the feed url here if you don't use the http:// or www. in front of it (this way it wont be posted as link so there is no problem)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Jul 03, 2009, 05:28:23 am »

Thanks for the reply! And the advice - my feed is at pbem2.com/xml.php

Ok, I see what I did wrong: I put my variable between the square brackets for $settings instead of after the square brackets. So I had this:
Code:
<?php $settings ['myusername'] = 'USERNAME';// Your twitter username
$settings ['mypassword'] = 'PASSWORD';// Your twitter password
$settings ['MysiteURL'] ='FEED';//The url of the feed we are going to post to twitter ?>


instead of this:
Code:
<?php $settings ['twitter-username'] = 'myusername';// Your twitter username
$settings ['twitter-password'] = 'mypassword';// Your twitter password
$settings ['feed-url'] ='MysiteURL';//The url of the feed we are going to post to twitter ?>


So when it was looking for the variable 'feed-url' it wasn't finding it because I'd typed over it. DUH.

Now the script executes with a blank screen. I created a test post on my site, verified it's in the feed, the executed the script - but the post didn't appear on my Twitter account. It's nice that the script executes silently so I can create a CRON job to run it when the time comes, but for now can someone help me with some checks I can put into the code to make sure it's executing each step properly? I'm not a novice at PHP, but I am completely self-taught and CURL is something I've never messed with so I'm not sure what it does.

Any help is greatly appreciated!
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5642
45485 credits
Members referred : 3



« Reply #3 on: Jul 17, 2009, 04:30:31 am »

It should display an error if there is a problem. Maybe while you were debugging the log file has been created (feed.log.txt) and kept the last feed item. In that case it wont post until you add another item in your feed (or just delete the log file Smiley ).

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8890
Tags : php feed twitter Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Error: Post an RSS feed to Twitter
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 09, 2010, 09:05:30 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!





Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2010 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.