Hi guys, I'm actually developing a project which I will get all the data from a particular website and export it to excel. Does anyone created a php project similar to mine? Please do help me on how to develop it. On the project that i am currently doing, the details can be viewed(details from another website) on my page. How do I save it to a container or straight to the database? Thanks a lot!
Here's the code that I have right now:
function testVPN()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://smtracker.pg.com/pls/smtracker/pg_tracker.sm_details?i_id=IM03252634");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = array(
'i_service' => "FSS SAP",
'i_max_recs' => ""
);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$check = true;
if($output == false)
{
$check = false;
}
return $check;
}
class fss_methods {
function parse_array($beg_tag, $close_tag, $output)
{
preg_match_all("($beg_tag.*$close_tag)siU", $output, $matching_data);
return $matching_data[0];
}
function curlSM($service){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://smtracker.pg.com/pls/smtracker/pg_tracker.inc_service");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'i_service' => $service,
'i_max_recs' => ""
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $output;
}
function AllIncidentInformation($p_service,$p_workgroup){
$class = new fss_methods();
$output=$class->curlSM($p_service);
$container=$class->parse_array('<tr>','</tr>',$output);
$supercontainer=array();
$i = 0;
$fruit=array_pop($container);
foreach ($container as $value){
$value=trim($value);
$value= trim(preg_replace('/[^(\x20-\x7F)]*/','', $value) );
$container[$i]=$value;
$info=explode(' ', $value);
foreach ($info as $x){
if(($x == "")||($x == null)||($x == " "))
{
echo '****|';
}
else
{
echo $x.'|';
}
}
echo '<br>';
}
}
}
$class = new fss_methods;
$vpn = testVPN();
$vpn_msg = '';
if($vpn == false)
{
$vpn_msg = "<font color='red'>WARNING: Unable to capture critical tickets. Kindly connect to P&G network.</font><br>";
}else{
$vpn_msg = "<font color='green'>Good Day! You are now connected to P&G network.</font><br>";
}
echo $vpn_msg;
$class->AllIncidentInformation('FSS SAP','G.AFRGSM');
?>
What would be the next step in order to export it? I already have the details but in order to access it, there should be a vpn connection in which i am connected to.