WWW-Myspace - Re: Modify Profile

Posted on Thu Apr 13 03:50:30 2006 by sbrady in response to 2153 (See the whole thread of 5)
Re: Modify Profile
Hello Grant. Okay, I've got it working.... here's the code I'm using.... it needs to be made more generic of course.... but I thought I'd send it to you anyhow.... you can either throw it in and modify it.... or let me know, and I'll try to get to it! Oh, and right now it only modifies the about me section, but of course that can be generisized... just had to get it together quickly for a single purpose app. Thanks - Sean
## follow the Edit Profile link $mech->get("http://editprofile.myspace.com/index.cfm?fuseaction=profile.interests"); ## submit edit interests form my $edit_interest_fields = { interestLabel => 'aboutme' }; _submit_form(2, $edit_interest_fields); ## submit edit interests preview form my $edit_preview_fields = { interestLabel => 'aboutme', interest => $content }; _submit_form(2, $edit_preview_fields); ## final submit my $edit_final_fields = { interestLabel => 'aboutme', interest => $content }; _submit_form(2, $edit_final_fields); return 1; } sub _submit_form { my ($form_number, $fields) = @_; $mech->form_number($form_number); $mech->set_fields(%{$fields}); $mech->current_form; my $result = $mech->submit(); if ($result->content() =~ /\berror\b/i) {die new Sink::Error("MySpace", "ERROR")} return 1; }
Direct Responses: 2156 | 2160 | Write a response