I'm trying to view content from a website that is secured. It makes me login into to view the content.
<?php
$homepage = file_get_contents('http://www.example.com/');
echo $homepage;
?>
What I'm trying to is to be able to view the content without having to view it in the browser.
I just want to run the script from my desktop. Download the data into an excel sheet.
Down in the future, I might categorize the information that gets displayed.
Can someone give me any advice?
I see it can be done in C#, but something like this be developed in php?
// prepare the web page we will be asking for HttpWebRequest request = (HttpWebRequest) WebRequest.Create(""); // execute the request HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // we will read data via the response stream Stream resStream = response.GetResponseStream(); string tempString = null; int count = 0; do { // fill the buffer with data count = resStream.Read(buf, 0, buf.Length); // make sure we read some data if (count != 0) { // translate from bytes to ASCII text tempString = Encoding.ASCII.GetString(buf, 0, count); // continue building the string sb.Append(tempString); } } while (count > 0); // any more data to read?



Reply With Quote
Bookmarks