We help IT Professionals succeed at work.

Post a bookmark to www.rawsugar.com (for ciuly if possible)

crystyan
crystyan asked
on
303 Views
Last Modified: 2010-04-05
Hi there,

Try this:
go on www.rawsugar.com and login as fakedusername and password: mypassword. then there`s a yellow bottom on the right named Tag RawSugar. I hope u can find it. click on it and it will appear a new window with these fields: tags, title, url and note (and some more hidden).

Please tell me how could I post that from my application after I login of course... the login is not very hard. but I think they send crypted data when bookmarking ? or something like that.

here`s the login function that I use:
  PostData('http://www.rawsugar.com/pages/loginAction.faces',
    'login=' + rawsugar_login.User + '&pswd=' + rawsugar_login.Pass +
    '&SubmitLogin=sign-in&__iframe=false&__dg=&__de=&__dc=&__dw=');

  Result := pos('Welcome, ' + rawsugar_login.User, HTML) > 0;

// postdata is posting data to the server and puts the html content into HTML.

hope it makes sence. any questions with no problem !

PLEASE!

Thanks a lot.
Comment
Watch Question

Top Expert 2007

Commented:
as I see, they use application/x-www-form-urlencoded encoding which means you have to make sure that this is done by the component.
check this:
http://www.w3.org/MarkUp/html-spec/html-spec_8.html
The form-urlencoded Media Type

The default encoding for all forms is `application/x-www-form-urlencoded'. A form data set is represented in this media type as follows:
The form field names and values are escaped: space characters are replaced by `+', and then reserved characters are escaped as per [URL]; that is, non-alphanumeric characters are replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks, as in multi-line text field values, are represented as CR LF pairs, i.e. `%0D%0A'.
The fields are listed in the order they appear in the document with the name separated from the value by `=' and the pairs separated from each other by `&'. Fields with null values may be omitted. In particular, unselected radio buttons and checkboxes should not appear in the encoded data, but hidden fields with VALUE attributes present should. (26)

now this encoding type is the default one used for forms, so ... it should work without any problems. strange that it doesn't.

I presume that you keep the logged in state correctly (send all needed cookies).

one easy way to debug such issues is:
- get a packet sniffer, that is best to know the http protocol so that it puts all packets in order and such
- set up the sniffer so that it will sniff the http traffic (some sniffers require explicit configuration for this)
- do the form post with the browser and then check the exchange between browser and server
- now do the same with your application

see what is the difference and fix it ;)

if you can't get it to work, then I'll try to make a sample poject sometime tomorrow (if no one else solves this until then :) )

Author

Commented:
Hi there,

do know why when I`m using the indy component I get an exception 'HTTP/1.1 302 not Found.' ? with the other component it`s working :(( it drives me crazy ...

Thanks

Author

Commented:
and the url exists !

Author

Commented:
and I just found out (using a sniffer) that the component I use sends max 255 chars to the server !!!! WHICH IS NUTS !!!

I should use Indy ... could u make me a sample of a procedure like this

procedure PostHTML(url: String, params: String);

I guess the params should be converted to a TStrings replacing & with #13 ...

Thanks ciuly!
TheRealLokiSenior Developer
CERTIFIED EXPERT

Commented:
have you set "HandleRedirects" to true?

Author

Commented:
lol, that was a problem, thanks. now I can`t figure out why it`s sending max 255 chars ? it simply cuts the rest of the line at Indy too ... so let`s say if we have lots of parameters ... what should I do ?

Thanks
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
thanks a lot ciuly !!! I`ll test it tomorrow cuz today I`m at my parents.

Author

Commented:
hi ciuly,

this really works :D

but, couldn`t u make this as a procedure that takes as parameters the url and the list of parametrs ? so I can use ... PostHTML(login_url, user_pass); PostHTML(posturl, parmeters_to_post);

this way I can use this function on more sites. do I need 2 different functions for log in and post the bookmark because of the setcookies procedure ?

Thanks!

Author

Commented:
doesn`t make sence the last reply lol :D

THANKS A LOT !

I`ll post a new question soon as I want to award u more for this. The question should be much simple than this :-)

THANKS, THANKS, THANKS MAN !
Top Expert 2007

Commented:
heh, you can't use the same login/post data/etc function on more than 1 site because
- the parameters will deiffer
- some sites have custom ways of doing login, keeping persistance, posting data, getting data, etc

you can however make some general function/component that will do the login and keep the persisten connection and which knows how to post data to a general web form so you can use it for later posts.
but you will have to be very carefull when you write it.
why? well .. take the geocaching and this rawsugar cases: the first one was pretty strait forward. the second one has a software redirect. software redirects are not something that can be easily detected because they can be done in a variety of ways for which you need a browser like component OR, to write code possible redirection codes .. but will not work in 100% of the cases.

I was thinking about such a copmnonent after getting this question as they are starting to pile up :) so it is obvious that there is a need for such a component, but I just don't have the time right now. maybe in a few eeks. In an case, I wrote it down along with the other projects I have in mond so it will probably get done in a few weeks or months. you can chek my site once a month to see if there is anything new on this matter. (I will have some notification process in place on my site sometime ... in the future :D )

about that other question: EE has a strict policy regarding "awards", so I would say not to bother with putting up a "zombie" question for that. when you will have anotehr real issue and I will be able to help you, you can increase the points if you really want to :)

peace

Author

Commented:
it`s not a "zombie" question lol :-) It`s a real question that I want u to respond me :-). Anyway ... if someone else answers it`s np. I`ll award him. I don`t want to create u probs here :-)

thanks!
Top Expert 2007

Commented:
oh, sorry for the missunderstanding. well in that case post the link here when you post the question and I'll take a look
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.