Jump to content

natasha_thomas

Members
  • Posts

    225
  • Joined

  • Last visited

    Never

Posts posted by natasha_thomas

  1. Folks,

     

    I tired all my PHP skills to extract domain name strings from a RSS Feed and put each domain name as an Array element, but all in vain:

     

    Here is the RSS:

     

    http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php

     

    What i want to extract:

    Do you see a list of domain names, which are Anchored, all i need is to extract these domain names llik "abc.co uk"  (observe there is a space between .co and uk, which can be removed with str_replace())

     

    Here is my first try: (Using SimpleHTMLDomParser)

    require_once('simple_html_dom.php');
    
    $html = file_get_html('http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php');
    
    $domains = $html->find('div[class="entry"] a', 0);
    
    foreach($domains as $dom)
    {
        
        
        echo str_replace(' ', '.', $dom->plaintext);
    } 
    
    $html->clear();
    unset($html);
    

     

     

     

    Here is my another try with DOM Document:

    $scrapeurl = 'http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php';         
    
    $keywords = file_get_contents($scrapeurl);
    
    $keywords = json_decode($keywords);
    
    foreach( $keywords->responseData->results as $keyword) 
    {    
        echo str_replace("...",".",$keyword->title).'<br/>';
       
        }
    
    

     

     

     

    In both the cases, DOM document is created but it seems the Document has all information except the Domain names i want to extract.

     

    Please help me out to extract the doamin names.

     

    Cheers

  2. Folks,

     

    I have an Image URL, i want to show this image on my site but i want to resize the image on the fly.

     

    Image:

    http://ecx.images-amazon.com/images/I/41daynaberL._SL75_.jpg

     

    What i am doing is:

    <img height="100" width="80" src="http://ecx.images-amazon.com/images/I/41daynaberL._SL75_.jpg" />

     

    But its not resizing the Image...

     

    Any solutions?

     

    Cheers

    N

  3. User-agent: googlebot

    Request-rate: 1/10  # maximum rate is one page every 10 seconds.

     

    Thanks DW.

     

    1) Will it effect my SEO with Googlebots negatively, as i am restricting them to crawl slow?

     

    2) Do i need to register to Webmaster tool for this to work? (Because i do not want to register my site with Google Webmaster)

     

    Cheers

    N

  4. Folks,

     

    I want to echo an HTML tag in PHP.

     

    <td width="300" bgcolor="#ffffff" align="center" onmouseout="style.backgroundColor='#ffffff'" onmouseover="style.backgroundColor='#e8e8e8';" style="word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);">

     

    So what i am doing is;

     

    echo '<td width="300" bgcolor="#ffffff" align="center" onmouseout="style.backgroundColor='#ffffff'" onmouseover="style.backgroundColor='#e8e8e8';" style="word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);">'; 

     

    And its now working because this tag already has ' (Single Quotes) & ; (Semicolon)  so its conflicting.

     

    Any work around for this friends?

     

    Cheers

    N

  5. Folks,

     

    I just had a thought might sound dumb but will be dumber if i dnt share.

     

    Is it possible to ask googlebots to spider/crawl my site slowly instad of sending multiple threads to crawl my site.

     

    By slowly i do not mean just spider one of two pages, what i mean is spider one page then another and another, so i can better manage my server resources.

     

    I think there is something crawl delay setting or something like that can be done in robots.txt

     

    All i am worried is, will it work against the SEO of My sites?

     

    Any thoughts?

     

    Cheers

    NT

     

     

  6. Many Thanks NJ, it was helpful.

     

    I understand in the first paragraph you talked about dedicated Proxies, i once took membership of Private proxies they seem to be too expensive.

     

    Running TOR on your server wont cause any issue. Just use it as a client and not a server otherwise you will have traffic coming through your server.

     

    1) You mean to say i should use TOR as Desktop client and not install on Server? I rather want to install TOR on my linux webserver and not on my machine.

     

    2) Is Polipo and Privoxy paid/subscription services? Cnt i just use TOR on my server and call their IPs in CURL?

     

    Cheers

  7. That's a good link. I haven't used Polipo with Tor, only Privoxy.

     

    Once you have it installed you would add the proxy option to your Curl instance i.e

     

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8118');
    

     

    Get curl to grab a page such as http://www.whatismyip.com/ Do it with & without the proxy option set. You should find that the IP in the grabbed source code is different when using Tor.

     

    NJ & Mr. Maq,

     

    Thanks for Guidance.

     

    Few Questions:

    1) Will using TOR make things very very slow both Server Resources wise and Site load wise?

     

    2) Can you please confirm, am i correct with the below code:

     

    $URL = 'www.scrapeme.com';
    $ch = curl_init();           
    $tor_address = '127.0.0.1:8118';           
    curl_setopt ($ch, CURLOPT_PROXY, $tor_address);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, true);
    curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    curl_setopt ($ch, CURLOPT_URL, $URL);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);

     

    3) NJ, what is Polipo & Provoxy, what is to do with TOR?

     

    Cheers

    NT

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  8. I am doing CURL on a site which is on WAP

    WAP, my god how old is it. WAP is for phones that are probably 10 years old. Do you mean a mobile version of a website. If so you could use any mobile user agent to obtain the mobile version of a website.

     

    Here are a few

    http://learnthemobileweb.com/mobile-web-development/sample-mobile-user-agents/

     

    I wouldn't worry too much about the user agent string like you are. To make your bot more natural make sure there is a random pause period between page requests. Also, I would use proxies or a proxy client such as TOR to make sure that your own IP address doesn't get blocked by the site if they suspect anything.

     

     

    NJ,

     

    You are right, i meant the mobile version of site.

     

    Is it possible to implement TOR on web server? I have seen only Windows Desktop verison of TOR, can it be implemented on my web server (lunux)?

     

    Cheers

  9. I don't understand the question. What do you mean by Mobile Bot? There are massive online lists of user agents that you can trawl through. If you give a bit more info on what you are trying to do there may be a way to help where you do not need to use the complete agent string (this is bad anyway as it is bound to change)

     

    Thanks for the reply NJ.

     

    I am doing CURL on a site which is on WAP, ti make my CURL calls natural i want to use Google or yahoo Mobile Bot user-agent strings, so it shows up like google/ yahoo mobile bots crwaling.

     

    Ofcourse its no fool-proof as apart from User-agent we need IP as well, but i am ok with User Agents only.

     

    Hope that helps.

     

    Cheers

  10. Folks,

     

    I am using SIMPLEHTMLPARSER.

     

    I am not able to parse HTML, looks like nothing is showing up when i do

     

    var_dump($html->find('div[id=Teaser_Item] img[src]', 0));
    

     

    Actually, what i want to extract is the IMG SRC which is:

     

    http://wap.ebay.com/Pages/RbHttpHandler.ashx?width=313&height=592&fsize=999000&format=jpg&url=http%3A%2F%2Fi.ebayimg.com%2F00%2F%24%28KGrHqN%2C!jEE2n%28iTLozBNwBPG0bUg~~0_1.JPG%3Fset_id%3D8800005007

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><META HTTP-EQUIV="expires" CONTENT="0"><META HTTP-EQUIV="cache-control" CONTENT="no-cache"><META HTTP-EQUIV="pragma" CONTENT="no-cache"><META name="google-site-verification" content="2AT13qxpDWUTCw-6xXa-Hme6iQ7ds3rYZ5cH5-_K13Y"><META http-equiv="Content-Style-Type" content="text/css"><title>YSLBlack Suede Platform Pumps Size 7 (39) - eBay Mobile (item 160586179890 5/14/2011 8:39:22 AM)</title><link rel="stylesheet" type="text/css" href="/nbinternal/global.css"><style>div.body {margin-left:5px !important;margin-right:5px !important;width:1253px;} div, p, td, span, li {color:#000000;} div.body > div, div.body > table {color:#000000;} hr {color:#000000;} a {color:#0000CC;} td.tabbed-active, a.tabbed-active {border-bottom-color:#FFFFFF;} div, td, form, li, input, select, textarea {font-size:12px;} .medium, .medium *, .medium td * {font-size:12px !important;} .headline *, .medium .headline * {font-size:14px !important;} .large .headline *, .headline .large * {font-size:16px !important;} .large, .large *, .large td * {font-size:14px !important;} .small .headline * {font-size:12px !important;} .small, .small *, .small td * {font-size:10px !important;} </style></head><body style="width:1253px;background-color:#FFFFFF;"><div class="body" style="width:1253px;background-color:#FFFFFF;"> <div style="margin-bottom: 4px;background-color: #ffffff;" id="CommonHeader" class="pageheader mode1"><table class="pageheader" cellspacing="0" cellpadding="0"><tr><td class="logo" style="background-color: #ffffff;"><a href="/Default.aspx?emvAD=1263x592&aid=160586179890&emvcc=0"><img src="RbHttpHandler.ashx?width=1253&height=592&fsize=999000&format=gif&url=%7E%2FImages%2FeBayLogos%2Funscaled___ebay_logo_large.gif" alt="eBay mobile"></a></td></tr></table></div><div id="ebayLine1" class="separator mode1"> <img src="RbHttpHandler.ashx?width=1253&height=592&fsize=999000&format=gif&url=%2Fimages%2FeBayLines%2Funscaled___630.gif" alt="" class="separator "> </div><div id="Status" class="default"> <div style="margin-left: 5px;margin-right: 5px;padding-top: 4px;padding-bottom: 4px;border:none;" id="Teaser_Item" class="teaser mode11"><table cellpadding="0" cellspacing="0" style="width:100%;"><tr><td style="vertical-align:top;padding-right:2px;width:317px;" valign="top"><img src="RbHttpHandler.ashx?width=313&height=592&fsize=999000&format=jpg&url=http%3A%2F%2Fi.ebayimg.com%2F00%2F%24%28KGrHqN%2C%21jEE2n%28iTLozBNwBPG0bUg%7E%7E0_1.JPG%3Fset_id%3D8800005007" alt=""></td><td class="ttext" style="vertical-align:top;" valign="top"><strong>YSLBlack Suede Platform Pumps Size 7 (39)</strong></td></tr></table></div> <div style="padding-top: 0px;padding-bottom: 0px;border-color: #fae273;border-style: solid;border-width: 1px;border-top:none;border-left:none;border-right:none;background-color: #ffd869;background-image: url(RbHttpHandler.ashx?url=/images/BlockHeader/unscaled___630.gif);background-repeat: no-repeat;background-position: top-left;" id="BgHeader" class="text mode1 small"> <div> </div></div> <div style="padding-top: 4px;padding-bottom: 4px;vertical-align: middle;border-color: #bababa;border-style: solid;border-width: 1px;border-top:none;border-bottom:none;background-color: #f0eff7;text-align: center;" class="buttonmenu mode2"> <span id="ButtonRefresh" class="button-image" style="margin:0px;background-color: #7a7a7a;margin-right: 3px;"><a href="/Pages/ViewItem.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" class="button-inactive" style="color: #ffffff !important;border-color: #606060;border-style: solid;border-width: 1px;border-style: solid;"><strong>Refresh</strong></a></span> </div></div><div id="Content" class="default"> <div style="padding-top: 0px;padding-bottom: 0px;text-align: center;line-height: 1.5em;background-image: url(RbHttpHandler.ashx?url=~/Images/TabbedMenu_BgGradient.jpg);background-repeat: repeat-x;background-position: top-left;" id="MenuA" class="tabbedmenu mode1 small"> <table cellspacing="0" cellpadding="0"> <tr> <td style="color: #000000 !important;background-color: #ffffff;border-color: #bababa;border-style: solid;border-bottom-color: #ffffff;border-style: solid;text-align: center;line-height: 1.5em;" class="tabbed-active"> <a href="/Pages/ViewItem.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="color: #000000 !important;border:none;" id="ButtonMenuItem1" class="tabbed-active"> Summary</a> </td> <td style="color: #00008b !important;border-color: #bababa;border-style: solid;border-style: solid;text-align: center;line-height: 1.5em;" class="tabbed-inactive"> <a href="/Pages/ViewItemPic.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="color: #00008b !important;border:none;" id="ButtonMenuItem2" class="tabbed-inactive"> Picture</a> </td> <td style="color: #00008b !important;border-color: #bababa;border-style: solid;border-style: solid;text-align: center;line-height: 1.5em;" class="tabbed-inactive tabbed-last"> <a href="/Pages/ViewItemDesc.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="color: #00008b !important;border:none;" id="ButtonMenuItem3" class="tabbed-inactive"> Description</a> </td> </tr> </table> </div> <div style="vertical-align: top;border-color: #bababa;border-style: solid;border-width: 1px;border-top:none;border-bottom:none;" class="table mode1"><table cellpadding="0" cellspacing="0" style="vertical-align: top;"><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;font-weight:bold;">Item number:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><span style="color:#000000 !important;font-weight:bold;">160586179890</span></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;font-weight:bold;">Last Bid:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><span style="color:#000000 !important;font-weight:bold;">US $99.00</span></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;font-weight:bold;">Ended:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><strong>5/14/2011 8:39:22 AM</strong></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Bid count:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><span style="color:#000000 !important;">0</span></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">High bidder:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><span style="color:#000000 !important;">-</span></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Quantity:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top"><span style="color:#000000 !important;">1</span></td></tr></table></div> <div style="padding-top: 0px;padding-bottom: 0px;border-color: #bababa;border-style: dotted;border-width: 1px;border-bottom:none;border-left:none;border-right:none;" id="SeparatorLine1" class="text mode1"> <div></div></div> <div style="vertical-align: top;border-color: #bababa;border-style: solid;border-width: 1px;border-top:none;border-bottom:none;" class="table mode1"><table cellpadding="0" cellspacing="0" style="vertical-align: top;"><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Seller:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">namtalae (64)</td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Feedback:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">97.3% Positive</td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Location:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">Istanbul<br>TR</td></tr></table></div> <div style="padding-top: 0px;padding-bottom: 0px;border-color: #bababa;border-style: dotted;border-width: 1px;border-bottom:none;border-left:none;border-right:none;" class="text mode1"> <div></div></div> <div style="padding-top: 4px;vertical-align: top;border-color: #bababa;border-style: solid;border-width: 1px;border-top:none;border-bottom:none;" class="table mode1"><table cellpadding="0" cellspacing="0" style="vertical-align: top;"><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Ships to:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">Worldwide</td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Postal costs:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">US $25.50<br><a href="/Pages/ShippingCosts.aspx?emvAD=1263x592&aid=160586179890&emvcc=0">Additional</a></td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Insurance:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">Optional</td></tr><tr> <td style="padding: 4px;vertical-align: top;text-align: right;width: 45%;" valign="top"><span style="color:#999999 !important;">Payment<br>methods:</span></td> <td style="padding: 4px;vertical-align: top;width: 55%;" valign="top">PayPal</td></tr></table></div> <div style="padding-top: 0px;padding-bottom: 0px;border-color: #bababa;border-style: dotted;border-width: 1px;border-bottom:none;border-left:none;border-right:none;" id="SeparatorLine2" class="text mode1"> <div></div></div> <div style="padding-top: 3px;padding-bottom: 3px;border-color: #bababa;border-style: solid;border-width: 1px;border-bottom:none;background-color: #eaedf7;" id="PayPalInfo" class="text mode1"> <div></div></div> <div style="padding-top: 4px;padding-bottom: 4px;vertical-align: middle;border-color: #bababa;border-style: solid;border-width: 1px;background-color: #f0eff7;text-align: center;" class="buttonmenu mode2"> <span id="ButtonRefresh" class="button-image" style="margin:0px;background-color: #7a7a7a;margin-right: 3px;"><a href="/Pages/ViewItem.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" class="button-inactive" style="color: #ffffff !important;border-color: #606060;border-style: solid;border-width: 1px;border-style: solid;"><strong>Refresh</strong></a></span> </div> <div style="color: #808080 !important;" id="NotFullInfo" class="text mode1"> <div style="color: #808080 !important;"><strong>Note:</strong> To view the full item listing, visit www.ebay.com using a computer before you bid or buy.</div></div> <div style="padding-top: 0px;padding-bottom: 0px;border-color: #bababa;border-style: solid;border-width: 1px;border-bottom:none;border-left:none;border-right:none;" id="SeparatorLineBottom" class="text mode1"> <div></div></div> <div id="TextBreadcrump" class="text mode1"> <div><a href="/Pages/SearchResults.aspx?emvcc=0"><span style="color:#7A7A7A !important;font-weight:bold;">&#x3c;</span> Results</a></div></div></div><div style="margin-top: 4px;" id="EBayLine2" class="separator mode1"> <img src="RbHttpHandler.ashx?width=1253&height=592&fsize=999000&format=gif&url=%2Fimages%2FeBayLines%2Funscaled___630.gif" alt="" class="separator "> </div> <div style="padding-top: 0px;padding-bottom: 0px;" id="MainMenu" class="buttonmenu mode1"> <table width="1253" cellspacing="0" cellpadding="0"> <tr> <td><a href="/Pages/Search.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="border:none;"><img src="RbHttpHandler.ashx?width=417&height=592&fsize=999000&format=gif&url=%2Fimages%2FButtonMenu%2Fen%2Fgif%2F630%2Funscaled___bmenu_highlight_left.gif" alt="Search"></a></td> <td><a href="/Member/MyEbay.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="border:none;"><img src="RbHttpHandler.ashx?width=417&height=592&fsize=999000&format=gif&url=%2Fimages%2FButtonMenu%2Fen%2Fgif%2F630%2Funscaled___bmenu_normal_mid.gif" alt="My eBay"></a></td> <td><a href="/Default.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" style="border:none;"><img src="RbHttpHandler.ashx?width=417&height=592&fsize=999000&format=gif&url=%2Fimages%2FButtonMenu%2Fen%2Fgif%2F630%2Funscaled___bmenu_normal_right.gif" alt="Home"></a></td></tr></table></div> <div style="padding-left: 7px;" id="FooterMenu" class="pipedmenu mode1 small"> <a href="/Pages/About/US.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" id="BAbout" class="piped-inactive">About eBay</a> <span>|</span> <a href="/Pages/UserAgreement/US.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" id="BUA" class="piped-inactive">User Agreement</a> <span>|</span> <a href="/Pages/Help.aspx?emvAD=1263x592&aid=160586179890&emvcc=0" id="BHelp" class="piped-inactive">Help</a> </div> <div id="Text1" class="text mode1 small"> <div>view ebay in<br>Mobile | <a href="http://www.ebay.com/?redirect=mobile"> Classic </a></div></div></div></body></html>
    

     

    can someone help me debugging this, please?

     

    Cheers

    Natasha Thomas

     

  11. Friends,

     

     

    Requirement:

     

    I have written a script, which pulls data from various sources on the fly.

    So, URL Structure will be like:

     

    www.mydomain.com/findprod.php?q=paintball-mask

     

    And this findprod.php will use q value and pull data from other sources on the web. I want to make a Post on the Fly and then Write the post Content to Database, so that next time, if i hit the same URL (www.mydomain.com/findprod.php?q=paintball-mask), the Find Product will not be run coz that URL's Data has already been Cached. (Can W3 Cache Plugin Will do this all by its own?)

     

    In Other words, Purpose if to Mkae a Post on the Fly and write it to Database as a Cache.

     

     

    What i have Done:

     

    I have tried to use a fucntion wp_insert_post($ontheflypost) but where shall i put that function? In single.php of my Template or Where?

     

     

    global $user_ID;
    $new_post = array(
        'post_title' => 'My New Post',
        'post_content' => 'Lorem ipsum dolor sit amet...',
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );
    $post_id = wp_insert_post($new_post);

     

    If i put this snipper in function.php, where do i need to call this Function? Is it in single.php or where?

     

     

     

    How can this be done?

  12. If the URL is always going to look similar to that example, you can do something like

    <?php
    $str = 'http://www.amazon.co.uk/gp/aw/d/B004JN01LW/ref=mp_s_a_1?qid=1305169492&sr=8-1';
    $x  = parse_url($str);
    list(,,,,$part) = explode('/',$x['path']);
    echo $part . "<br>";
    ?>

     

    Ken

     

    Thanks Ken.. Works Good.

     

    Thank you so much to both the Senior Members (Ken & Gizmola).

  13. Folks,

     

    I want to extract something from a URL, i think we need to use regex for this.

     

    Example URL:

    http://www.amazon.co.uk/gp/aw/d/B004JN01LW/ref=mp_s_a_1?qid=1305169492&sr=8-1
    

     

    What we need to Extract:

    So we need to extract  B004JN01LW  from the URL.

     

    I tried to use substr() but i think its not useful for this purpose, can someone help me with Regex to extract this?

     

    Cheers

    Natasha

     

  14. Really what you want is a fall through rule for the 404 that follows the working rule, but otherwise broadly matches your pattern.  The existing rule will match what you want, and anything else will be redirected.  Trying to do a negative match is quite tricky and not really the strength of regex.  In this case you what you're really saying is

     

    -I could have a valid character OR not

    -and some number of invalid characters

    -AND some valid characters OR not

    -etc

     

    This is probably why you're having a hard time crafting something that works.

     

    Again many things Gizmola.

     

    can you tell me what is the Purpose of  " {4,})" in the above Rewrite rule?

     

    Cheers

  15. Folks,

     

    Requirement:

    I want a .htaccess level solution to 404 when the URL contains special characters other than mentioned in the below Rewrite rule:

     

    RewriteRule ^([a-zA-Z0-9-!@#$^&*:"<>/?]{4,})\.html$ search.php?q=$1 [QSA,L]

     

    So, what i want is, i want to show a 404 when the URL contains anything other than "a-zA-Z0-9-!@#$^&*:"<>/?"

     

     

    What i have done:

    RewriteRule ^([a-zA-Z0-9-!@#$^&*:"<>/?]{4,})\.html$ search.php?q=$1 [QSA,L]

     

     

    Problem:

    Its not working with Special characters but working only with English letters and Numerics in URL.

     

    Cheers

    Natasha T

  16. when I view the source page of the html file the only thing there is Javascript code.. I believe for file_get_contents.. it basically retrieves the code in the document as a string.. so $amacontent doesn't contain the string "No results for".

     

    thats why its not working. .. just for kicks plug the plain text "No results for" into the document. see if it works then.

     

    Ur right, the JS code itself goes into the PHP Variable, that's why its not finding "no Result for" string.

     

    Is there any way we can ouput the JS into PHP Variable?

     

    Below is the JS:

     

    <script type='text/javascript'>
    var amzn_wdgt={widget:'Search'};
    amzn_wdgt.tag='powlawofatt-21';
    amzn_wdgt.columns='3';
    amzn_wdgt.rows='10';
    amzn_wdgt.defaultSearchTerm='10 mp 5x zoom';
    amzn_wdgt.searchIndex='Electronics';
    amzn_wdgt.width='525';
    amzn_wdgt.showImage='True';
    amzn_wdgt.showPrice='True';
    amzn_wdgt.showRating='True';
    amzn_wdgt.design='2';
    amzn_wdgt.colorTheme='Default';
    amzn_wdgt.headerTextColor='#000000';
    amzn_wdgt.outerBackgroundColor='#FFFFFF';
    amzn_wdgt.marketPlace='GB';
    </script>
    <script type='text/javascript' src='http://wms.assoc-amazon.co.uk/20070822/GB/js/AmazonWidgets.js'>
    </script>

     

     

     

    Cheers

    Natasha

  17. <?php
    
    
    $amacontent = file_get_contents('http://minimate.co.uk/master/scripts/content/amazonsearch.php?kw=noprodcamera&cat=Electronics');
    
    
    if (strpos($amacontent, "No results for") === false) //if the string "No results for" IS NOT FOUND in $amacontent, then echo "Products found!".  This line should read "if (strpos($amacontent, "No results for") !== false)"
    {
        echo "Products found!";
    }
    else
    {
       echo "sorry no products found";
    }
    
    echo $amacontent;
    
    ?>
    

     

     

    This solution also does not work. :-(

     

    The pointer remains either in TRUE or FALSE irrespective of product found or not.  :-(

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.