The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. October 20, 2019, 12:21:35 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Automation  (Read 5414 times)
webinfoguy25
Journeyman
***
Offline Offline

Posts: 56


View Profile
« on: June 30, 2014, 07:38:25 AM »

Hey anyone know how I can grab these add to cart with options buttons off a thousand or so pages?

Some of them have options like color and size while others don't.


list of the item scripts that i have to use for making a external mobile site:
http://shopping.netsuite.com/app/site/query/listitems.nl?c=1256124&n=1

page with color and size options:
http://shopping.netsuite.com/app/site/query/itemscripts.nl?c=1256124&n=1&id=18792


page without color and size options:
http://shopping.netsuite.com/app/site/query/itemscripts.nl?c=1256124&n=1&id=60010

See attached screenshot for details...


* itemscriptpages.png (48.77 KB, 1402x530 - viewed 192 times.)
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: June 30, 2014, 06:15:52 PM »

Dude. That's a serious scrape effort. How good of a coder are you?
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
webinfoguy25
Journeyman
***
Offline Offline

Posts: 56


View Profile
« Reply #2 on: July 02, 2014, 05:36:27 AM »

Well I am a web developer so programming scripts isn't my thing.  Now could I pay you to help me with this?
Logged
webinfoguy25
Journeyman
***
Offline Offline

Posts: 56


View Profile
« Reply #3 on: July 03, 2014, 10:07:50 AM »

Dude. That's a serious scrape effort. How good of a coder are you?

Couldn't i use something like this:

Code:
<?php
/**
make an http POST request and return the response content and headers
@param string $url    url of the requested script
@param array $data    hash array of request variables
@return returns a hash array with response content and headers in the following form:
    array ('content'=>'<html></html>'
        , 'headers'=>array ('HTTP/1.1 200 OK', 'Connection: close', ...)
        )
*/
function http_post ($url$data)
{
    
$data_url http_build_query ($data);
    
$data_len strlen ($data_url);

    return array (
'content'=>file_get_contents ($urlfalsestream_context_create (array ('http'=>array ('method'=>'POST'
            
'header'=>"Connection: close\r\nContent-Length: $data_len\r\n"
            
'content'=>$data_url
            
))))
        , 
'headers'=>$http_response_header
        
);
}
?>

OR this:

Code:
/**
* Cross-Domain Script Requesting
*/
function loadScript(url, callback) {

var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;

if (script.readyState) { // IE
script.onreadystatechange = function() {
if (script.readyState == "loaded"
|| script.readyState == "complete") {
script.onreadystatechange = null;
callback();
document.body.removeChild(script);
}
};
} else { // Others
script.onload = function() {
callback();
document.body.removeChild(script);
};
}
document.body.appendChild(script);
}

/**
* Special Script Handling
*
* @param handler
* Special handling function
*
* @description Asynchronously get the amount of items in cart and update the
* view
*/
function getCartItemCount(handler) {

/**
* Target
*
* @type script
* @content document.write("0\n");
* @description the script content is unchangeable and undesired
*/
var url = "http://shopping.netsuite.com/app/site/query/getcartitemcount.nl?c=639743";

/**
* Firstly backup undesired handlers
*/
var _document_write_func = document.write;

/**
* Secondly replace undesired handlers with desired handlers
*/
document.write = handler;

/**
* Then Start loading cross-domain script
*/
loadScript(url, function() {

/**
* At last restore undesired handlers
*/
document.write = _document_write_func;
});
}
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: July 06, 2014, 10:03:33 PM »

Sorry man. I'm just not in this space enough to even give that much thought.

And I'm WAY no longer the guy you want to pay to do that. Bomps might (but he'd probably do it in PERL rather than PHP).

Send him a PM and see if he's still available for that kind of work.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
webinfoguy25
Journeyman
***
Offline Offline

Posts: 56


View Profile
« Reply #5 on: July 13, 2014, 07:39:53 AM »

What?  Lol I have been hacking out the code and im a total newbie...you got soft on us?   ROFLMAO

There I attached the pdf of the entire code I have now and also some img urls of it seperated out so you don't have a hernia Wink: Need Help








* index.pdf (35.59 KB - downloaded 252 times.)
« Last Edit: July 13, 2014, 07:44:55 AM by webinfoguy25 » Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: July 14, 2014, 03:28:18 PM »

LOL no, what I mean is that I do not have any kind of time to even look at your code right now.

I'm president of a small but growing medical cloud business and it consumes just about every minute of every day. I have a huge list of things I need to code for myself I can't even seem to get to.

So it's my bad that I just can't do the time right now.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #7 on: July 14, 2014, 04:49:23 PM »

I'm president of a small but growing medical cloud business and it consumes
just about every minute of every day. I have a huge list of things I need to code
for myself I can't even seem to get to.

Outsource some of that.  Wink
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #8 on: July 14, 2014, 06:00:58 PM »

Actually looking at that today, Bomps. Trying to figure the right resource for the most problematic parts ... very VERY HTML5y and CSS3ish browser-side database, websocks, gotta adhere to a particular look - it's a pain.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
webinfoguy25
Journeyman
***
Offline Offline

Posts: 56


View Profile
« Reply #9 on: July 17, 2014, 08:08:19 AM »

Its all good I cracked the code on this one:

Code:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><?php echo $_GET['pagetitle']; ?></title>
<script type="text/javascript" src="http://shopping.netsuite.com/javascript/NLUtil.jsp__NS_VER=2014.1.0&minver=112&locale=en_US.nlqs"></script>
<meta name="viewport" content="width=320, user-scalable=no">
<link rel='stylesheet' href='http://contourmd.net/mobile/m/css/style.css?ct=101&bglt=ffffff&bgmd=DFD8EA&bgdk=808080&bgon=EEEBFC&bgoff=DFD8EA&bgbar=DFD8EA&tasktitletext=7A60A9&crumbtext=7A60A9&headertext=7A60A9&ontab=181566&offtab=181566&text=181566&link=0000ff&bgbody=ffffff&bghead=DFD8EA&portlet=DFD8EA&portletlabel=DFD8EA&bgbutton=ff9900&bgrequiredfld=ffff99&font=Trebuchet+MS%2CHelvetica%2Csans-serif&size_site_content=14pt&size_site_title=18pt&size=1.0&nlinputstyles=T&NS_VER=2014.1.0&3'>
<script type="text/javascript" src="http://contourmd.net/c.1256124/mmh/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://contourmd.net/c.1256124/mmh/scripts/jquery.jscroll.min.js"></script>
<script type="text/javascript" src="http://contourmd.net/c.1256124/mmh/scripts/mobileScripts.js"></script>

</head>
<body bgcolor='#FFFFFF' vlink='#181566' alink='#181566' text='#000000' style='margin:0' width='320px' height='480px' onload="page_init()">
<div id='outerwrapper' style='width:955;margin: 0 auto;'>
<div id='innerwrapper'>
<div id='div__header'
class='noprint'
leftmargin='0' topmargin='0' marginwidth='1' >
<table border='0' cellspacing='0' cellpadding='0' width='100%'>
<tr>
<td>
<tr><a href="/"><img src="http://contourmd.net/mobile/m/templates/m/contourmdmobilelogo.jpg"></a>
</tr>
</table>
<div class="clearfix"></div>
</div>
<div id='div__title' style='margin: 0px;'>
</div>
<div id='div__label' class='scrollarea' style='margin: 0px; overflow:hidden;'>
</div>
<div id='div__body' style="margin: 0px; ">
<table border='0' cellspacing='0' cellpadding='0' width='100%'>
<tr>
<td></td>
<td valign="top">
</td>
</tr>
</table>
<td width="780" valign="top" align="left" style="padding-top:0px; padding-left:0px;">
<table width="780" cellpadding="0" cellspacing="0" border="0">
        <tr class='portletHandle' id='handle_itemMainPortlet' >
<td width='100%' height=0 align='left' valign='top'>
<table border=0 cellspacing=0 cellpadding=0 width='100%'>
<tr>
<td width=0 height=0 align='left' valign='top' style='display:none'>
<td valign='top' width='100%'>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr valign='top'>
<td>
<table width='100%' border='0' cellspacing='0' cellpadding='5'>
<tr>
<td>
<div class="clearfix"></div>
<!-- Mobile item drilldown new -->
<div class="headerright">
<script src='http://shopping.netsuite.com/app/site/query/getcustomermessage.nl?c=1256124&n=1&ckinvalidate=T&prefixtext=Welcome%20&suffixtext=!&unrecognizedtext=Welcome%20to%20ContourMD'></script>
View Cart (<script src='http://shopping.netsuite.com/app/site/query/getcartitemcount.nl?c=1256124&n=1'></script>) = <script src='http://shopping.netsuite.com/app/site/query/getcarttotal.nl?c=1256124&n=1'></script></div>

<!-- GET ITEM NAME START -->


<p><span class="productname" id="productname"><script src='http://shopping.netsuite.com/app/site/query/getitemname.nl?c=1256124&n=1&id=<?php echo $_GET['id']; ?>'></script></span></p>



<!-- GET ITEM NAME END -->

 
<!-- GET ITEM IMAGE START  -->

<img src=<?php echo $_GET['imageurl']; ?>>

 <!-- GET ITEM IMAGE END -->
 
  <div class="mydiv" id="extcartborder">
<div class="square-info">
<div class="toptitle">100% SECURE ONLINE ORDERING</div>
 
     <div class="text-price colors_text list">MSRP:</div>
<div class="value-price">

<script src='http://shopping.netsuite.com/app/site/query/getitemprice.nl?c=1256124&n=1&id=<?php echo $_GET['id']; ?>'></script></div>
<div class="text-price colors_text our">Retail:</div>
<div class="value-price price"><span id="itemprice<?php echo $_GET['id']; ?>"><script src='http://shopping.netsuite.com/app/site/query/getitemprice.nl?c=1256124&n=1&id=<?php echo $_GET['id']; ?>'></script></span></div>
<img src="http://contourmd.net/mobile/m/assets/images/Icon_FreeShipping2.png">
<br>

 <!-- MPN START -->


<?php echo $_GET['name']; ?><br>
 
 <!-- MPN START END -->

<br>
<img src="http://contourmd.net/mobile/m/assets/images/ChooseTitle.png">
<br>

<table>
   
<table>

 
<?php
// c and id are called in the call to netsuite. I'm unsure how these are generated.
function DescriptionGet($c$id)
{
// Attempt to get the entire text document from the corresponding page.
$pagetext file_get_contents("http://shopping.netsuite.com/app/site/query/itemscripts.nl?c={$c}&n=1&id={$id}");

// Ensure that both the page was found, and has content
if(is_string($pagetext) && strlen($pagetext) > 0)
{
// Without an item ID, this string is the exact identifier of where the body of text is
$needleInitial "<textarea rows=16 cols=50 wrap='VIRTUAL'>";
$trimSpotFromInitial strpos($pagetext$needleInitial);
// Need to ensure that we found the text
if($trimSpotFromInitial !== false)
{
// Add the length of the trim text to the spot we trim from, since the text starts AFTER that
$trimSpotFromInitial += strlen($needleInitial);
$afterInitialTrim substr($pagetext$trimSpotFromInitial);

// We can safely assume that the information is correct at this point
$needleEnd "</textarea>";
$trimSpotToEnd strpos($afterInitialTrim$needleEnd);

$afterFinalTrim substr($afterInitialTrim0$trimSpotToEnd);
return htmlspecialchars_decode($afterFinalTrim);
}
}

return "Source page not found";
}
$id $_GET['id'];
echo 
DescriptionGet(1256124$id);
?>





</table>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id='div__footer' class='noprint' leftmargin='0' topmargin='0' marginwidth='1' marginheight='1'>
<td>
    <table>
        <div class="gwBrowseSection toTheEdge">
<div id="browseDept15531">
<div class="gwBrowseFirst upperCornersRound">
<a class="gwBrowse ellipsed" href="javascript:menuExpand('browseDept', '15531', '1553');">
Shop
</a>
</div>
</div>
<div class="hidden" id="browseDeptHidden15531">
<div class="gwBrowseSelectedFirst
upperCornersRound
">
<a class="ellipsed" href="javascript:menuClose('browseDept', '15531', '1553');">
Shop
</a>
</div>
<div class="awLnkWidSubLnks "><a href="http://contourmd.net/Catalog" class="ellipsed"> <span class="carat">&gt;</span> See All Categories </a></div>                <div class="awLnkWidSubLnks ">
<a href="http://contourmd.net/Brands" class="ellipsed">
<span class="carat">></span>
Brands
</a>
                </div>
                <div class="awLnkWidSubLnks ">
<a href="http://contourmd.net/Bras-And-Lingerie" class="ellipsed">
<span class="carat">></span>
Bras And Lingerie
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Closeouts" class="ellipsed">
<span class="carat">></span>
Closeouts
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Compression-Garments" class="ellipsed">
<span class="carat">></span>
Compression Garments
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Garments-By-Procedure" class="ellipsed">
<span class="carat">></span>
Garments By Procedure
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Garments-By-Type" class="ellipsed">
<span class="carat">></span>
Garments By Type
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Girdles-And-Binders" class="ellipsed">
<span class="carat">></span>
Girdles And Binders
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Hosiery-And-Socks" class="ellipsed">
<span class="carat">></span>
Hosiery And Socks
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Maternity" class="ellipsed">
<span class="carat">></span>
Maternity
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Shapewear" class="ellipsed">
<span class="carat">></span>
Shapewear
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Recover-Aids" class="ellipsed">
<span class="carat">></span>
<b>Recovery Aids</b>
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Scar-Treatment" class="ellipsed">
<span class="carat">></span>
Scar Treatment
</a>

                </div>
                <div class="awLnkWidSubLnks ">
<a href="/Mastectomy-Recovery" class="ellipsed">
<span class="carat">></span>
Mastectomy Recovery
</a>

               </div>
</div>
<div id="browseDept15532">
<div class="gwBrowseRightArrow">
<a class="brBrowseRightArrow ellipsed" href="http://shopping.netsuite.com/app/site/query/customercenterredirect.nl?c=1256124&n=1&ext=T">
Your Account
</a>
</div>
</div>
<div id="browseDept15533">
<div class="gwBrowseRightArrow">
<a class="brBrowseRightArrow ellipsed" href="http://shopping.netsuite.com/app/site/query/checkoutredirect.nl?c=1256124&n=1&ext=T&login=T&newcust=T&reset=T">
Register
</a>
</div>
</div>
               <div id="browseDept15534">
<div class="gwBrowseRightArrow">
<a class="brBrowseRightArrow ellipsed" href="http://shopping.netsuite.com/app/site/query/checkoutredirect.nl?c=1256124&n=1&ext=T&login=T">
Login
</a>
</div>
</div>
               <div id="browseDept15535">
<div class="gwBrowseRightArrow">
<a class="brBrowseRightArrow ellipsed" href="http://www.contourmd.com/s.nl?sc=3&ck=QzAcPf_gAdaImLZ1&vid=QzAcPf_gAeOImCBG&cktime=123138&gc=clear&ext=T">
View Cart
</a>
</div>
</div>
<div id="browseDept15536">
<div class="gwBrowseRightArrow lowerCornersRound">
<a class="brBrowseRightArrow ellipsed" href="http://shopping.netsuite.com/app/site/query/checkoutredirect.nl?c=1256124&n=1&ext=T">
Checkout
</a>
</div>
</div>
</div>
    </table>
</td>
</div>

</body>
</html>
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!