I have to convert my web page to pdf in php. I googled and found several leads.
http://pdfcrowd.com/web-html-to-pdf-php/
How to convert a PHP web page to PDF?
However, my web page is password protected. Is there a way a script can login (of course, the credentials will be provided) and then after successful login, convert the web page to html.
Is the above even possible? If yes, can someone give me some suggestions. If not, are there any alternate ways to do it?
Thanks
You may retrieve the page (pdf) contents using php curl with basic http auth.
Check How do I make a request using HTTP basic authentication with PHP curl?
Our PDFmyURL API allows you to login and convert the page to PDF. We support many different standard ways that your page can be protected, so you don't need to build any new way specifically for our API.
You can find the documentation on accessing content in secure members area at the PDFmyURL.com API documentation page
EDIT: in september 2015 we added functionality that allows you to log in to your members area directly from our own members area. All our tools (the API and also manual conversions) will then be able to access your members area pages without any problems.
You can also do a more simple thing.
ctrl + P = Print page
Then change destination to pdf file
After that choose where on computer to save the page and that's it.
Peardoc, the firm I work for, provides a solution to convert static/dynamic HTML to PDF on password protected web applications. This service requires the user, who has signed in, to click a "save as PDF" link.
Demo: http://www.peardoc.com/sap_pro_demo.html
"I have to do it automatically using a script. without user intervention."
Are you looking for, say, an API service, which will handle PDF conversion (post authentication) without user intervention?
just put this script one button will be generated for password protected pages use this one.
For Detail link - http://freehtmltopdf.com/
Related
I saw a few questions out there already about ensuring site access comes from QR code scans, but they seemed to be focused on analytics purposes (tracking where traffic was coming from), whereas my interest is in security/privacy.
I want to set up a site that can only be accessed when a provided QR code is scanned. In other words, I don't want the URL that the QR code possesses to be able to just be manually typed/pasted in for site access via other means.
I've been googling this issue for a bit with no luck whatsoever. I'm trying to think of a way with referring URLs or other means to ensure that a person arrived at the site by actually scanning the provided QR code.
EDIT: The solution would need to be scanner-independent as well (i.e. I cannot force users to download and use a specific QR scanner app) and cross-platform (Android + iOS + WinMo + BlackBerry, etc.).
Now I submit the issue to you wonderful folks.
We got something the same at our company. We provide a link like:
zxing://scan/?ret=http%3A%2F%2Ffoo.com%2Fproducts%2F%7BCODE%7D%2Fdescription&SCAN_FORMATS=UPC_A,EAN_13
Where {CODE} is the code which is returned in the QRCode. So what you can do is create an url like above (see more info for a link). And then put a encrypted data in the QRCode, so only if this url is clicked by the user and the data of the QRcode is correct. People can continue to go on your website. This way if the qrcode is leaked, they won't know the site. And if they know the site, the code is encrypted.
If people scan the barcode by clicking on your website. The zxing will open a new browser with the URL and the {CODE} filled with the scanned code.
But, people do need the barcode scanner from android or iphone.
More info:
zxing download / homepage
zXing scanning from w
You can't ensure that the URL came from scanning the QR code, that isn't possible. QR codes are just a method of encoding text, once the user knows the text they can do whatever they want with it.
You can, however, restrict the usefulness of the QR code so even if it is leaked it isn't useful. If possible, I would start by generating the QR codes on-demand with a random seed and have them expire shortly thereafter. This would make it so even if the QR code were leaked, it wouldn't be useful for very long.
About the best you can do is set a query string in your QR code. Something like:
http://www.example.com/myapp
Could be changed to something like:
http://www.example.com/myapp/?qrcode=1
This can then be handled in PHP with:
if(!isset($_GET['qrcode'])) die();
The problem with this, of course, though, is that anyone with the URL could simply navigate directly to that URL in their normal web browser.
This isn't something you can prevent, however.
You can also check whether $_SERVER['HTTP_USER_AGENT'] claims to be a mobile phone. Here's another question on the topic.
You could add parameters, but ultimately QR codes are just a method of encoding text, so whatever you encode can be typed into a browser if someone knows what's encoded.
If you are making post call to any web URL from QR code, then whatever body you are sending with it, will not be visible unless user went through QR scan mode.So by just entering Web URL user will not able to access web URL contents.
How do you retrieve the username of someone on Youtube who is using your application with PHP? I'd prefer to do this without the API but if needs be point me in the right direction because i don't know what to download , I've visited the google developers site / place already.
I found some code from 2009 but it was to retrieve usernames from a youtube video and it didn't work. I tried reading the contents of page with the fopen() and file_get_contents() but it always appears as if I'm not signed in whereas I am signed in via FireFox.
Don't know if this makes a difference but I was running this on EasyPHP via localhost
Thanks
You can't, by design. You do not have their session cookie server-side where you're using fread. Youtube determines whether you are or are not signed in based on that session cookie, and you do not have one on your server.
If you want their YouTube user name, use a client-side API in JavaScript or simply ask them for it with a text input field. It is impossible to find it server-side, as it should be. Your server has no business finding out my Youtube username without my express permission and interaction.
Not sure if this is even possible but since Verizon does not have an API set for this I thought I would look for an alternative.
As a verizon customer I can login to myverizon.com and from there they have a link to download an .XLS sheet with all of my recent history.
I would like to automate this process somehow but not sure if there is a way to create a session on another site with a valid username/password and then process to pull the file once credentials have been verified?
Right now I have to manually downlaod the XLS sheet and import into an application.
Thanks,
You need to use the CURL Library for this in PHP. It will allow you to post login credentials and save the cookie.
Login CURL Example
The above link demonstrates a login to Ebay using CURL
Well, there should be a way.
I cannot give you an instruction since I am not a Verizon customer. But you could start by trying to automate the XLS retrieval with Selenium.
Then, if you want to do it via PHP/cURL (as is suggested by your tags), you could translate the Selenium file to corresponding cURL requests.
Update: Also, please make sure that this is okay according to the terms and conditions of your contract with Verizon.
I wanted to find out how to login to another site via PHP... I don't know the proper term for it, but basically, I want a user to be able to enter their login information for another website on mine, and interact with it through mine.Is there any tutorial?
thanks
There are few ways to do the job (actually, you just need to send POST data to the other site).
You can use :
curl (example: http://davidwalsh.name/execute-http-post-php-curl),
stream context (example: http://php.net/manual/en/function.stream-context-create.php),
or directly with sockets (example: http://www.jonasjohn.de/snippets/php/post-request.htm).
curl will do that PHP, cURL post to login to WordPress
but you will need that installed on the server which is sometimes not an option. There is however loads of scripts that can do the same thing as curl without the curl libs installed, eg: cakephp's HttpSocket class
as already stated, Curl will do that.
But you can also check out this PHP Class that makes everything easier and gives you a lot of automation out of the Box
Including Prefilling of CSRF Token, finding of all input fields, retrieving of details from the designated site. etc
the class can be found Here. Crawl Engine
i created an application with some models, after that, i used ACL and created some ACOs to protect my Application.
Now i wanted to add a RESTful API to my application, so i edited routes.php with something like that
Router::mapResources('routes');
Router::parseExtensions();
this also works fine, for example going to http://localhost/myapp/routes.json gives me a json object of my routes if i'm already logged in
shure, somebody cannot do a login with a web-form when he is using my API, so i want to know if it is possible to send the regular login informations with the request using REST Auth Basic (or Digest) and use the working ACL in my App to authenticate and show the result object (or if its wrong, send the right header)
any ideas?
if something is unclear, PLEASE leave a comment
i used the newest cake php version 1.3.3
If you look at other API based services, usually they use token to identify user. For example if there is username matt and he has token 123456, you can give him access to url http://localhost/myapp/123456/routes.json. Then, in your controller, you can authenticate the user by using token.
http digest authentication is possible when javascript is used to handle the authentication process, non-javascript clients default to having the standard popup.
Probably they won't mind though.
Info found at http://www.peej.co.uk/articles/http-auth-with-html-forms.html :
The main reason people walk away from
using HTTP authentication is that they
want control over the look of the
login form and most browsers display
an awful looking dialog box. So what
we need is a way for HTML forms to
pass HTTP auth data when it's
submitted. The HTML spec provides HTML
forms as a way to create queries and
to POST urlencoded data to a URL, but
can we subvert it?
It comes with a warning :)
Warning: The solution outlined in this
article is experimental and might be a
complete lie, be warned that your
mileage may/will vary.