Christian F. Posted February 6, 2013 Share Posted February 6, 2013 There's something odd going on here... Try to add this line above the two you quoted above: echo "<pre>";var_dump ($html);die(); Quote Link to comment https://forums.phpfreaks.com/topic/274033-how-to-convert-number-in-string-to-value-then-calculate-markup/page/2/#findComment-1410564 Share on other sites More sharing options...
mahogan Posted February 6, 2013 Author Share Posted February 6, 2013 (edited) It still hangs at: Getting price. Here is the exact code that I have: <?php error_reporting(-1); include('simple_html_dom.php'); // Request parameters $materialid = $_GET['materialid']; $sizeid = $_GET['sizeid']; $quantity = $_GET['quantity']; $numcolors = $_GET['numcolors']; // form URL for request //$url = "http://www.suppliersite.com/pricing?materialid=104&sizeid=37&quantity=1&numcolors=1"; $url = "http://www.suppliersite.com/pricing?materialid=".$materialid."&sizeid=".$sizeid."&quantity=".$quantity."&numcolors=".$numcolors; // Create DOM from URL or file $html = file_get_html($url); // Echo page //echo $html->plaintext; //Code that creates $html echo "<pre>";var_dump ($html);die(); $price_per_item = $html->find('#price-per-item'); var_dump ($price_per_item); // $price_per_item = $html->find('#price-per-item'); $total_price = $html->find('#total-price'); $description = $html->find('.description'); $name = $html->find('h3'); //echo $price_per_item[0]."<br />"; //echo $total_price[0]."<br />"; //echo $description[0]."<br />"; //echo $name[1]."<br />"; // Iterate through all combinations: echo "<table id=\"products\">"; echo "<tr>"; //echo "<th>Price per item</th><th>Total Price</th><th>Product</th><th>Description</th><th>Size</th><th>Quantity</th>"; echo "<th width=\"25%\">Price per item</th><th width=\"15%\">Total Price</th><th width=\"30%\">Product</th><th width=\"10%\">Size</th><th width=\"10%\">Colors</th>"; echo "<tr>"; $price_per_item = $html->find('#price-per-item'); $total_price = $html->find('#total-price'); $description = $html->find('.description'); $size = $html->find('select[id='.'top-sizes-select'.'] option[value='.$sizeid.']'); echo"<tr>"; echo "<td>".$price_per_item[0]."</td>". "<td>".$total_price[0]."</td>". "<td>".$name[1]->innertext."</td>". // "<td>".$description[0]."</td>". "<td>".$size[0]->innertext."</td>". "<td>".$numcolors."</td>"; echo "</table>"; echo "<br />"; echo "<div style=\"width:40%\">"; echo $description[0]; echo "</div>"; ?> Is it possible that there is a security protocol from my supplier site that is preventing this from working? Edited February 6, 2013 by mahogan Quote Link to comment https://forums.phpfreaks.com/topic/274033-how-to-convert-number-in-string-to-value-then-calculate-markup/page/2/#findComment-1410567 Share on other sites More sharing options...
mahogan Posted February 6, 2013 Author Share Posted February 6, 2013 (edited) Ok, I was looking up online why the var_dump() function might be failing and I found this, not exactly sure if it is relevant: http://stackoverflow...ump-not-working So, I see with their issue, it was something to do with thier Ajax script. So I got to looking at my files, and wonder if this is helpful? Here is the my script that deals with Ajax getting the pricing data, this is located within a javascript section of my index page: //////////////////// GET APPLICABLE SIZE OPTIONS FOR SELECTED MATERIAL function sizeOptions(materialid) { //alert(materialid); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('sizeid').innerHTML=xmlhttp.responseText; additionalOptions(materialid); } } xmlhttp.open("GET","options.php?materialid="+materialid,true); xmlhttp.send(); } //////////////////// GET ADDITIONAL OPTIONS - DOUBLE SIDED & GROMMETS function additionalOptions(materialid) { //alert(materialid); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('radio').innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","additional_options.php?materialid="+materialid,true); xmlhttp.send(); } //////////////////// GET PRICES VIA AJAX function getPrices(materialid, sizeid, quantity, numcolors) { //alert("Materal ID: "+materialid+" Size ID: "+sizeid+" Quantity: "+quantity+" # of colors: "+numcolors); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('price').innerHTML=xmlhttp.responseText; } } document.getElementById('price').innerHTML="<p/ ><b>Getting price. Please wait....</b>"; xmlhttp.open("GET","price.php?materialid="+materialid+"&sizeid="+sizeid+"&quantity="+quantity+"&numcolors="+numcolors,true); xmlhttp.send(); } Not sure if this is helpful, if so please let me know. Thanks again! Edited February 6, 2013 by mahogan Quote Link to comment https://forums.phpfreaks.com/topic/274033-how-to-convert-number-in-string-to-value-then-calculate-markup/page/2/#findComment-1410602 Share on other sites More sharing options...
mahogan Posted February 7, 2013 Author Share Posted February 7, 2013 Well, I am at wits end with this... so if anyone is interested in some freelance work, I posted this project for hire, there are some additional factors to that of what I was working on here. https://www.freelancer.ph/projects/PHP-Javascript/Serif-WebPlus-integrate-php-script.html Quote Link to comment https://forums.phpfreaks.com/topic/274033-how-to-convert-number-in-string-to-value-then-calculate-markup/page/2/#findComment-1410612 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.