NOTE: Newest Version is LOCATED HERE.
Everyone knows that MySpace has a terrible reputation for being a closed system and not allowing developers access to any API. As a result, those of us who run our blogs centrally on self-hosted WordPress installs, as well as many other I’m sure, face the tedious task of manually crossposting to MySpace if you maintain a presence there as well.
Some developers have tried to write plug-ins to do the job, but MySpace is constantly trying to thwart the attempts by relentlessly changing their system.
Fed up with it, I decided to write my own such system and base it on a pretty standard, straight-forward mechanism with the hopes that changes on the MySpace side of things wouldn’t have much effect on the functioning of my code.
In truth, it’s not so much an auto crossposter as it is an auto notifier, but that’s by choice, can be changed on the fly and actually has its advantages.
The first advantage is formatting. I’m rather particular with my formatting and getting MySpace to behave exactly as one wants is, as any user knows, a true pain in the arse. It’s senseless to try to truly format on MySpace, so, I’ve opted to make each new auto entered MySpace blog read as follows:
This keeps the format clean, but has a second added advantage: It encourages people to visit my actual WordPress blog, where I want them to be!
A very simple modification would of course post the entire entry, rather than my customized message, but I’ve chosen to go this route with it.
Of course, the entry on the main profile page lists the appropriate title for the blog entry too:
QUICK INSTRUCTIONS
NOTE: As of August 2, 2007, this script is running fine on a WordPress 2.2 install with PHP 4.3.11, CURL 7.10.6 and MySQL 5.0.18. Though it should run fine on any fairly recent install of these apps, I am here disclosing that the author has only tested it personally and thoroughly on the above install. All others are on their own if it doesn’t work.
NEWEST VERSION IS 2.0a – LOCATED ON THE NEW 2.0 PROJECT PAGE
1.) Save the two files locally
Click on the above links, view the source, and copy and paste each into a new file titled “pingmyspace.php” and “pingmyspace-exec.php”, respectively.
2.) Make minor changes so it works for you.
Modify only the clearly labeled variables at the top of pingmyspace.php with your own information and save.
3.) Upload
Upload the files to your server. Place them anywhere you like – preferably in a directory all its own.
4.) Setup the automatic ping
NOTE: Do NOT activate the plug-in on your plugins administration panel. The method of activation is as follows:
In the WordPress Admin panel, select Options > Writing.
In the Update Services box at the bottom of the page, enter the direct URL for the pingmyspace.php file that you just uploaded:
example: http://www.yourdomain.com/yourdirectory/pingmyspace.php
Click Update Options to save.
The next time that you publish to your blog, WordPress will call your pingmyspace.php file automatically and your MySpace blog will be automatically updated!
To test the functionality, you can manually visit the url of your pingmyspace.php file and the last entry that you made will be crossposted to MySpace.
THE CODE
I owe a huge debt to Greg Sidberry over at elsid.net and his MySpace Access Class and by extension Harry Maugan for his MySpace Login with PHP and cURL and Brad Turcotte (brad [at] bradsucks.net) for some initial development. I may clean up my version sometime down the road and stick to the bare bones of the MySpace Login with cURL and a few of my own self-written blog updating functions, but for now I’m using Greg Sidberry’s work and figured that, in the interest of helping others solve the problem, you’d like to see it sooner rather than later.
The code is pretty straight forward. The first step – requesting pingmyspace.php – does the back-end work of logging into the WordPress database and selecting the latest published entry. It does a little bit of necessary formatting and then simply includes the (modified) MySpace Access Class, establishing the MySpace connection, and then updates the blog with the freshly fetched and formatted data. Simple as that.
Hope this is helpful!
##
UPDATE – JUNE 9, 2007 – NEW VERSION 1.1a
At the urging of Greg Sidberry ( elsid.net ), this code has been submitted to WordPress as a plug-in.
Many thanks to Andrew Brenton ( fxetc.com ) for submitting a mod to prevent accidental repeated crossposting to MySpace. His code has been incorporated into the latest release.
NEW FILES
Instructions remain primarily the same (as given above) but the new files for the latest version are here:
or
Please note that you should save the files locally and transfer them to your server with the new filenames (pingmyspace_v1_1a.php and pingmyspace-exec_v1_1a.php), not the old pingmyspace.php and pingmyspace-exec.php.
Note that I am not giving any guarantees that I will continue to update or support this code. Future versions may or may not be released. Code is shared as is. You are always welcome to submit mods and if I continue development, suitable mods will be incorporated and full credit given. Future releases are entirely dependent upon schedule and availability of time.
UPDATE – JUNE 12, 2007 – NEW VERSION 1.2a
Version 1.2a has been uploaded. This really should have been v1.1.1a, but that’s too many decimals for my liking. The changes here are very minor and current users do not need to move to this new version. The only change is the addition of a verbose output option for testing and troubleshooting. This option will be in all future versions and as there are no major functionality changes, current users can wait until the next major revision to upgrade.
UPDATE – JUNE 13, 2007 – NEW VERSION 1.3a
Another minor change, but important for many users. The method of retrieving and constructing the URL for the post has been modified and will now work with any permalink structure. The previous versions would only accommodate the permalink structure that I use (as I wrote it originally to solve my problem) which is in fact a custom structure. As a result, some people were finding that the plug-in would generate incorrect url’s to their posts. The problem is now fixed and will work for everyone.
UPDATE – JUNE 17, 2007 – NEW VERSION 1.4a
NOTE: If you are unwilling to read and follow the install instructions, do not bother downloading this plugin. THE PLUGIN SHOULD NOT BE ACTIVATED ON YOUR PLUGINS ADMINISTRATION PANEL. Users who do not read the instructions continually get errors when they try this, and then come here to complain about it. If you take the time to FOLLOW THE DIRECTIONS you will find that 9 out of 10 users have no problem at all. I’m more than willing to help out with diagnosing problems as long as you’ve kept up your end of the bargain and have actually read and followed the instructions first.
Added the option to easily choose between posting a notification message on your MySpace blog, or the entire blog entry itself.
Users with non-standard table names in their WordPress install now have more support and can easily set new table names to reference.
UPDATE – SEPTEMBER 11, 2007 – NEW VERSION 2.0a
The code and its operation has undergone a HUGE change. The newest – and easiest to use – version is on THE NEW 2.0 PROJECT PAGE.
COMING VERY SOON
-New option to send out a MySpace bulletin announcing a new blog entry with each blog update.
###
[tags]blogging, Crossposting, cURL, MySpace, MySpace Access Class, MySpace crossposting, PHP, ping, pinging, plugin, WordPress, wp[/tags]


Thanks for this, it really helped me.