Try using body.textContent instead of body.innerHTML. You'll get just the text, which should be much more similar to what you get via copy-and-paste.
--Tom
cbryancu wrote:
> I am trying to save some clicking. I currently select all, copy and
> paste a webpage into a form, which when submitted, send the info to a
> php parser to file into a mysql database. I am collecting sports
> scores for a youth league and was hoping to utilize greasemonkey to
> automatically copy and post the same info, eliminating the form I use
> currently. Our league has several divisions, with over 300 teams
> playing and the scores of games are posted in several sub-sites and in
> different formats (the division do there own thing) and I am trying to
> track it all and place it into one single db. It is all volunteers and
> quite spread out, and there is no central league website. It doesn't
> take too long to copy/paste stuff, but I came across another script in
> a game, which logged page views. I am not to fluent in js, so looking
> for a bit of guidance.
>
> I need to format the POST so that it would mimic the select all, copy
> & paste of the current form. I was trying to use the games setup, but
> it fails.
>
> GM_xmlhttpRequest({
> method:"POST",
> url:"http://xxxxxx.php",
> headers:{
> "User-Agent":"scores",
> "Content-Type":"application/x-www-form-urlencoded"
> },
> data:"url=" + encodeURIComponent(window.location.toString()) +
> "&html=" + encodeURIComponent(document.body.innerHTML)
> });
>
>
> url tracks the website address, and the html is the doc body. I
> believe I need to strip_slash the html portion, but my attempts have
> not worked. The document.body.innerHTML grabs everything inside the
> <body> tags and the encodeURIComponent is confusing to me. I have
> tried to format the data above the POST, with strip_slash and a few
> other things to no avail. I need the data for the html to be like a
> select all, copy/paste into the form. The format of the scores is of
> no concern, just looking to collect the team names and game scores.
> The current parser works well and I was hoping to use the existing
> parse script.
>
> Thanks for any help.
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
signature.asc
Description: OpenPGP digital signature
