Log into site and download file via PHP - php

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.

Related

Converting a password protected web page to pdf

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/

Auto login into gmail account using php

I have the gmail login credintals. Is it possible to login automatically to Gmail if we pass the username and password through url or by CURL.
I need to be login into gmail account before run my some php code.
Is there any php function or script that run first by passing gmail username and password and make login into browser.
can you provide a complete php code for login into gmail account just by passing username and password.
I am working on google trends. I need to be get csv file of google trends.
I have function that generate the google trend url for particular key word.
when I manually login into gmail account below link allow me to download csv file.
http://www.google.com/trends/trendsReport?hl=en-US&q=search,&geo=US&date=today 7-d&gprop=&cmpt=q&content=1&export=1
If your login into gmail account and click on above link, will allow you to download report.csv file.
I need this csv file to be download into my project directory, say into upload folder.
So, basically I need, one script that login me into gmail account and one script that allow to download report.csv file into upload directory.
If any one has solution for above problem, please provide a solution here.
I don't know about schemas as linked by Dainis; however, briefly looking through the website I don't know that I would be confident that would work.
I' feel you might be looking in the wrong direction. If all you are trying to do is automate something from the browser side, use JavaScript. You can create a bookmarklet that will fill out a Google login form and then automatically go to a URL to download a CSV. I'd imagine most if not all of what you are trying to do can be done using JavaScript and if not, you can use JavaScript to automate authentication and then load a PHP page with the rest of the code.
If you insist on using PHP Try checking this question out and good luck:
PHP script to automate login and form submit

php - How to open a ssrs rdl file in php

Hi friends I have a rdl file and they have given me the service url & username and password details.
In my php webpage i must place a run link for this rdl file.When the user clicks the rdl file the reports must be shown in my php webpage.
I have a googled and found this link http://ssrsphp.codeplex.com/ useful but could not able to figure out where to start.They have given a lot of procedures for this.I do notwant all those things.
I just want to run the rdl file and show its results
How can i achieve this?
It sounds like you are making this more complicated than it needs to be. You can access Reporting services with the URL and have a web page or stream for some other file type returned to your php page, which you can send on to the user.
The .rdl file needs to be uploaded to the SSRS service one time, before you can request that it is rendered. Use the service url you were provided with, and make sure that you see the report there. Then test that you can run the report and see results. Now you can make calls to the service and get those results which can be used as needed.
(Note that the default url for SSRS management is usually similar to https://servername/reports/ but the service is accessed at https://servername/reportserver/
Take a look at "URL Access" for a simple way of consuming SSRS:
http://technet.microsoft.com/en-us/library/ms153586.aspx
Look into the URL Access for displaying SSRS Reports directly from the SSRS Server.
For example:
http://serverName.local/ReportServer?/example/testReport&rs:Command=Render&rs:Format=HTML4.0&rc:Toolbar=False
Will display your specified report in a browser. You can easily hook this into another website.

Get Youtube username without API PHP

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.

how to login to another site via PHP

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

Categories