I have an web-application in RoR which calculates some energy values and investment money. I use ajax to send the data from the web-browser to the server. It is something like this: Browser-server-Browser-Server-Browser
This web-application is already integrated in typo3 and I want to implement a PDF button to send the results per email (in other words, a photo of the page with the results).
I have heard an option would be to generate some links in RoR to be used in typo3 (when clicking on it, it would open exactly the web-application with the results already calculated). But as a newbie, I do not really know which would be the best approach.
Any recommendation?
A screenshot of the page can be done client-side:
http://html2canvas.hertzen.com/
You could even have another page with the same results that you use only for the rendering of the result page what you use for making a clean screen-shot (you might not want to have the footer, menu and other elements on that page, only the results)
Once you have your screenshot, you can upload it to your server where you can use it to create a PDF of that image and then send it with any mail API you prefer to use.
info about TYPO3's mail api can be found here:
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Mail/Index.html
Related
I want to read the content (html) of a certain URL. I send a GET command, receive the html and I do what I want to do with it, no problem here.
The problem happens when a site loads more info into itself when you scroll down (like Facebook does), so the content I receive is the default one without the parts that are yet to be loaded. Any idea what can be done to retrieve the next parts automatically so I can read more and more of the content of such site?
I saw something about phantomJS but I'm developing a desktop application (using Delphi) so I can't use it. Thanks.
I am generating some linecharts via JSF (Primefaces).
So charts are accessible and generated nicely via accessing in any browser.
However i need to send those charts via email to certain persons cause they do not want to click on a link so this should be automated.
Is there a way to generate an image out of what the JSF is rendering ?
Thanks
Charts are canvas based and can be exported as static images with client side api.
Take a look here:
http://www.primefaces.org/showcase/ui/chartExport.jsf
Primefaces use Javascript Libraries to render the charts. You would have to process the browser output before sending the email.
(Also, lazy managers)
You would have to dig into the Java Image API (not JSF) in order to plot the graph (from the raw data) into an image if you want the JVM to send the email.
If you want to just automate the process in your machine to send the emails (so you can send the emails in one click instead of doing it all manually, be mindful of this caveat:
You would have to generate a custom page with print CSS and your email layout, then use a browser plugin that sends the email on a click.
I'm writing my first single page application and have a requirement by where the user is going to need to upload documents and/or images.
Is this a show stopper for using a spa or is there a work around?
I seem to be able to find very little on this on the net so I'm wondering if this requirement would mean creating a normal mvc site?
Its possible to upload files using ajax, so no show stopper there. you might need a controller to accept the file though, but that shouldn't be an issue.
Check out this tutorial on an ajax upload
http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
or you can check out uploadify, i think that does file upload via ajax too
Im trying to send some data to a form on a site were im a member using cURL, but when i look at the headers being sent, they seem to have been encrypted.
Is there a way i can get around this by making the computer / server visit the site and actual add the data to the inputs on the form and then hit submit, so that it would generate the correct data and post the form ?
You have got a few options:
reverse engineer the JavaScript that does the encryption (or possibly just encoding) process
get a browser engine (e.g. the Gecko engine), and add some scripting to it to fill in the forms and push the submit button - of course you would need JavaScript support within the page itself
parse the HTML using an HTML parser, feed the JavaScript in it to a JavaScript runtime with the correct libraries, fill in the "form" and hit the submit button
It's probably easiest to go for the first option. The JavaScript must be in the open to be able to be executed in the browser. But it may take some time to reverse-engineer as it is likely obfuscated.
You can use a framework to automate user interaction on the web pages, like Selenium.
This would enable you to not bother reverse engineering anything.
Selenium has binding in various languages, including Python and java.
Provided the javascript is visible on the website in question, you should be able to simply copy and paste their encryption routines to prepare the headers exactly as they do
A hacky fix if you can isolate the function that encodes the data you type in the form - is to use something like PyV8 to execute the JS inside python.
Use AutoHotKeyIt and actually have it use the Browser Normally. It can read from files, and do repetitive tasks infinitely. Also you can push a flag to make it only happen within that application, which means you can have it minimized and yet still preform the action.
You seem to be having issues with the problem of them encrypting the headers and such, so why not simply use that too your advantage? Your still pushing the same data in, but now your working around their system. With little to no side effect too you.
Currently I'm developing a flight ticket search engine(pretty similar to this-http://www.momondo.com/) which will gather all the information of a site. I' m done with the grab the info from the website.
So for each, search result,it do consist of a button like the site (Select) which will let user to redirect to according site to book the ticket.
Scenario:
on my site, I search for a location(from-to) ,then it comes out with lists of search result. I found out a search result that suit me and I click the 'Book' button and it should be redirect to AirAsia flight ticket with the data filled(like location from-to) on the Airasia site,then can direct book from the AirAsia site.
As I know for ruby on rails, there is a watir gem to simulate the user. But how to achieve this tasks? I do know when direct to the specific site , it need to pass all the parameters to the site in order to simulate or perform searching on the site.
any advice are appreaciated :D It's RoR project.
You could load the remote website in an iframe on the page and then use JavaScript to fill in the required fields.
AFAIK there isn't an easy way to fill in the fields on a remote site without using server side code on the remote site.