I need some help.
I have this JavaScript on site that renders a ticker with a value (progressive).
<script src='http://www.externalsite.com/modules/common/getProgBlock.php?progid=1&cbox=all&showlogo=no¤cy=USD'></script>
Its rendering is this:
$12,546.07
I tried to parse this JS file:
<?php
$html_data = file_get_contents('http://www.externalsite.com/modules/common/getProgBlock.php?progid=1&cbox=all&showlogo=no¤cy=USD', 'r');
echo $html_data;
?>
and I get this all JS parameters.
EDIT This is the parsed JS:
var scripts = document.getElementsByTagName('script');
var currentScript = scripts[scripts.length - 1];
currentScript.id = ((currentScript.id.length === 0) ? "mgsProgressiveTickerControlScript" : currentScript.id);
function cleanQueryString(querystring) {
querystring = querystring.replace(/^[^\?]+\??/, '');
querystring = querystring.replace('fontfamily', 'font-family').replace('fontsize', 'font-size').replace('fontcolor', 'font-color');
querystring = querystring.replace('showlogo=yes', 'showlogo=true').replace('showlogo=no', 'showlogo=false');
querystring = querystring.replace('showcasino=yes', 'showcasino=true').replace('showcasino=no', 'showcasino=false');
querystring = querystring.replace('showonlycasino=yes', 'showonlycasino=true').replace('showonlycasino=no', 'showonlycasino=false');
return querystring.toLowerCase();
}
var lowerQueryString = cleanQueryString(currentScript.src);
function parseQueryString(queryString) {
var queryStringParams = {};
if(!queryString) {
return "{}";
}
var queryStringPairs = queryString.split(/[;&]/);
for(var i = 0; i0) {
txt += " ";
}
txt += data[i];
}
return txt;
}
renderTicker = new function () {
this.init = function (lowerQueryString) {
document.write("");
var newScript = document.getElementsByTagName('head')[0].appendChild(document.createElement('script'));
newScript.id = "mgsProgressiveTickerAsmxScript";
newScript.setAttribute("type", "text/javascript");
newScript.src = ((window.location.protocol == 'https:') ? "https://" : "http://") + "www.externalsite.co.uk/ProgressiveTickers/WebServiceProgressiveTicker.asmx/renderTicker?form=json&booIsSecure=" + ((window.location.protocol == 'https:') ? true : false) + "&strProgId=" + getParam('progid', 'jackpot') + "&booShowLogo=" + getParam('showlogo', true) + "&booShowCasino=" + getParam('showcasino', false) + "&booShowOnlyCasino=" + getParam('showonlycasino', false) + "&strFontFamily=" + getParam('font-family', null) + "&intFontSize=" + getParam('font-size', 0) + "&strFontColor=" + getParam('font-color', null) + "&strCurrId=" + getParam('currency', null);
this.parseResult = function (data, strProgId, strCurrId, booShowOnlyCasino) {
document.getElementById("progressiveTicker" + strProgId).innerHTML = cleanHTML(data);
if((document.getElementById("progressiveTicker" + strProgId).innerHTML.length > 0) && (booShowOnlyCasino == 'false')) {
var scrollScript = document.createElement('script');
scrollScript.id = "mgsProgressiveTickerScriptScroll";
scrollScript.setAttribute("type", "text/javascript");
scrollScript.src = ((window.location.protocol == 'https:') ? "https://" : "http://") + "www.externalsite.co.uk/ProgressiveTickers/WebServiceProgressiveTickerScriptScroll.asmx/renderScript?form=json&strProgId=" + strProgId + "&strCurrId=" + strCurrId;
document.getElementById("progressiveTicker" + strProgId).parentNode.insertBefore(scrollScript, document.getElementById("progressiveTicker" + strProgId).nextSibling);
}
};
};
};
var mgsProgressiveTickerSharedFunctions = document.getElementById('mgsProgressiveTickerSharedFunctions');
if(mgsProgressiveTickerSharedFunctions === null) {
var INSERTmgsProgressiveTickerSharedFunctions = document.getElementsByTagName('head')[0].appendChild(document.createElement('script'));
INSERTmgsProgressiveTickerSharedFunctions.id = "mgsProgressiveTickerSharedFunctions";
INSERTmgsProgressiveTickerSharedFunctions.src = ((window.location.protocol == 'https:') ? "https://" : "http://") + "www.externalsite.co.uk/modules/common/sharedfunctions.php";
}
document.getElementById(currentScript.id).parentNode.removeChild(document.getElementById(currentScript.id));
renderTicker.init(lowerQueryString);
I need to pass the "progressive value" into a PHP variable to store the same value into a MySql database (I also have a script that can do this).
How can I pass this "value" into a PHP variable? What's the best approach? Please, help. I'm a totally noob in PHP!
Thanks in advance to all!
echo $html_data
print? – Rocket Hazmat Jan 21 at 14:54