How to do form entry with SwiftSoup?
jawshoeadan opened this issue · 1 comments
I see that there is a FormElement.swift file leading me to believe it's possible, but I haven't been able to find any examples. Can someone help show me how to automatically enter forms with the POST method using SwiftSoup?
I think there is no method to submit form atm. It's in the todo list [1][2] though. An alternative cumbersome way is parse form [3] and create [4] and submit a network request. Don't forget to encode data according to enctype
[5].
[1] https://github.com/scinfu/SwiftSoup/blob/master/Sources/FormElement.swift#L48
[2] https://github.com/scinfu/SwiftSoup/blob/master/Tests/SwiftSoupTests/FormElementTest.swift#L56
[3] https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data#The_POST_method
[4] https://stackoverflow.com/questions/50115905/how-do-i-attach-data-in-post-request-swift/#answer-50116064
[5] https://www.w3schools.com/TAGs/att_form_enctype.asp