I've been trying for a few days to create a php script which will go to https://secondlife.com/currency/market.php and scrape the daily summary data for a project I'm working on (since that info isn't available via download). My goal is to automate this process and track it in a database. I have everything working except this scraping element and I'm frustrated after trying several tactics and spending a lot of hours trying to figure out a workable method. I'm hoping you all can help me out with some suggestions for a new direction or possibly some code since I'm at my wit's end.
My latest tactic has been to try to use php's cURL functionality. I get it to work on other pages, but I'm getting nothing when trying to get the one page I want, namely that market data. The following code is what I think would work, but does not.
CODE
<?php
$url = "https://secondlife.com/account/login.php";
$post_request = "form[type]=second-life-member&form[nextpage]=/currency/market.php&";
$post_request .= "form[persistent]=Y&";
$post_request .= "form[username]=Sol&form[lasntame]=Columbia&form[password]=mypasswordhere";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
curl_close($ch);
print($data);
?>
Anyhow, if anyone knows anything about what I'm doing wrong, or has any suggestions on a different track, I'd really appreciate it, and thank you very much in advance!