web developers- please help me-think advance

මවං මේක කරන්නෙ කොහොමද බං?
මෙහෙම හිතමුකො..
www.abc.com/def/ghi කියල web site එකක්තියෙනවා. ඒකෙ ඇතුලෙ <div id"myDiv> Welcome to the page</div> කියල තියෙනව. ඒක අපිට අදාල නැති internet එකේ තියෙන වෙනම එකක්.
දැං තමයි අපේ page එක.
මට ඔින, අර කලින් web page එකේ තියෙන div එක විතරක් image එකක් විදියට save කරගන්න.

කොහොමද මචං script එක ලියන්නෙ?

 

joshmiller

Well-known member
  • Feb 23, 2014
    3,305
    220
    63
    pitarata
    thats web scrapping , you need php'd file_get_contents() or just just make a curl request .

    parse the response which is html or xml whatsoever , find the image you want , its that simple .

    *sometimes web scrapping is illegal
     
    thats web scrapping , you need php'd file_get_contents() or just just make a curl request .

    parse the response which is html or xml whatsoever , find the image you want , its that simple .

    *sometimes web scrapping is illegal

    hey, thanks for the reply. actually I don't need to save any image in the web page. but to save like screenshot of the exact div
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,714
    12,619
    113
    127.0.0.1:8080/Kandy
    oya wede 100% success na.. Site eke admin ubawa block nokaranakan ubata oka karanna puluwan..

    udin tiyena answer ekama tama matat denna tiyenne.. PHP walin HTML parser ekak hadanna..

    edit:

    mata weraduna... image ekak widihata save wenna.. nam mata idea ekak tiyenawa but..ane manda practicle na wage..

    idea ekak widihata: HTML parse karala one tika filter karan.. styles tikath grab karan wenama HTML file ekak temp. hadagannawa.. itapasse eke screencapture ekak gannawa.. mokak hari script ekak use karala.

    bump..
     
    Last edited:

    joshmiller

    Well-known member
  • Feb 23, 2014
    3,305
    220
    63
    pitarata
    is this what you looking for - ( screenshot of exact div )
    http://grabz.it/api/php/image-capture-options/



    HTML:
    <div id="features" class="container-features-and-analysis">
        <h2 class="features-header">Features & Analysis</h2>	
        <ul>  	
    		<li class="medium-image">
                <h3 class=" feature-header">
    	            <a class="story" rel="published-1349991058181" href="/news/world-middle-east-19914444">
    	            <img src="http://news.bbcimg.co.uk/media/images/63447000/jpg/_63447187_bed.jpg" 
    	            alt="A view of one of the two operating beds in the Aleppo hospital" />
    	            Traumatic surgery</a>
    		    </h3>		
    			<p>Ian Pannell meets Aleppo doctors working under bombs and shells 	
    			    <span id="dna-comment-count___CPS__19914444" 
    			    class="gvl3-icon gvl3-icon-comment comment-count"></span>
    			</p>
    			<hr />
    		</li>										
    		<li class="medium-image">
    For the example below we will select the div with the id "features" and output it as a 250 x 250px JPEG image.
    
    // The 250 parameters indicates that image should be sized to 250 x 250 px
    $grabzIt->SetImageOptions("http://www.bbc.co.uk/news", null, null, null, 250, 250, "jpg", null, "features");
    The next example takes another screenshot of the "features" div but this time outputs a JPEG image that is the exact size of the div.
    
    // The minus ones indicates that image should not be cropped
    $grabzIt->SetImageOptions("http://www.bbc.co.uk/news", null, null, -1, -1, -1, "jpg", null, "features");
     
    Last edited:
    oya wede 100% success na.. Site eke admin ubawa block nokaranakan ubata oka karanna puluwan..

    udin tiyena answer ekama tama matat denna tiyenne.. PHP walin HTML parser ekak hadanna..

    edit:

    mata weraduna... image ekak widihata save wenna.. nam mata idea ekak tiyenawa but..ane manda practicle na wage..

    idea ekak widihata: HTML parse karala one tika filter karan.. styles tikath grab karan wenama HTML file ekak temp. hadagannawa.. itapasse eke screencapture ekak gannawa.. mokak hari script ekak use karala.

    bump..

    ubata attama cn eka qwoth mchn.. podi wisthr thiyena site ekak.. page 10560k wthr thiyenw bn.. oka ekin eka krnn giyoth bn awrudu ganak yanawane bn.. oka look ekak dala wenn thibbama.. dws 2kak athuladiwath oka wela thiyevne.. e bisa site eken block krna ek gana hithann epa mchn..
    html ekanm parse krgnn puluwn.. but css ek thmi bn parse kr bari.. anika bn.. mata ona details tika enneth sql table ekakin wenn ona.. php set ekak athulen enne bn eek.. ekai.. kohomunath css thmi grab krgnn bri bn
     
    is this what you looking for - ( screenshot of exact div )
    http://grabz.it/api/php/image-capture-options/



    HTML:
    <div id="features" class="container-features-and-analysis">
        <h2 class="features-header">Features & Analysis</h2>	
        <ul>  	
    		<li class="medium-image">
                <h3 class=" feature-header">
    	            <a class="story" rel="published-1349991058181" href="/news/world-middle-east-19914444">
    	            <img src="http://news.bbcimg.co.uk/media/images/63447000/jpg/_63447187_bed.jpg" 
    	            alt="A view of one of the two operating beds in the Aleppo hospital" />
    	            Traumatic surgery</a>
    		    </h3>		
    			<p>Ian Pannell meets Aleppo doctors working under bombs and shells 	
    			    <span id="dna-comment-count___CPS__19914444" 
    			    class="gvl3-icon gvl3-icon-comment comment-count"></span>
    			</p>
    			<hr />
    		</li>										
    		<li class="medium-image">
    For the example below we will select the div with the id "features" and output it as a 250 x 250px JPEG image.
    
    // The 250 parameters indicates that image should be sized to 250 x 250 px
    $grabzIt->SetImageOptions("http://www.bbc.co.uk/news", null, null, null, 250, 250, "jpg", null, "features");
    The next example takes another screenshot of the "features" div but this time outputs a JPEG image that is the exact size of the div.
    
    // The minus ones indicates that image should not be cropped
    $grabzIt->SetImageOptions("http://www.bbc.co.uk/news", null, null, -1, -1, -1, "jpg", null, "features");

    This sounds like what I want. But I'll try and look if this can solve my problem.
    thank you bro.
     

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    ubata attama cn eka qwoth mchn.. podi wisthr thiyena site ekak.. page 10560k wthr thiyenw bn.. oka ekin eka krnn giyoth bn awrudu ganak yanawane bn.. oka look ekak dala wenn thibbama.. dws 2kak athuladiwath oka wela thiyevne.. e bisa site eken block krna ek gana hithann epa mchn..
    html ekanm parse krgnn puluwn.. but css ek thmi bn parse kr bari.. anika bn.. mata ona details tika enneth sql table ekakin wenn ona.. php set ekak athulen enne bn eek.. ekai.. kohomunath css thmi grab krgnn bri bn
    Ithin ai CSS one? IMG tag ekaka thiyena image eka newei da ganne.
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,714
    12,619
    113
    127.0.0.1:8080/Kandy
    Ithin ai CSS one? IMG tag ekaka thiyena image eka newei da ganne.

    mama oya wage scene ekak kara ban.. Wikipedia Wikimedia common walin... antimata mage PC eke blue screen enna patangatta dawas ganak on eke tibila..

    mage laga tiyenawa personal people info 1.2 million ganak.. births, deaths :P

    me tike Wikimedia parse kara kara hitiye.. unge photos ganna.. denata 4000i ban save wela tiyenne.. mata 12000kage photos one mage wedeta..

    man wikiyen 1mins walata requests dekai denme.. denata awlak une.. na.. but copyrighted ewa filter karala thama save karaganne..
     
    mama oya wage scene ekak kara ban.. Wikipedia Wikimedia common walin... antimata mage PC eke blue screen enna patangatta dawas ganak on eke tibila..

    mage laga tiyenawa personal people info 1.2 million ganak.. births, deaths :P

    me tike Wikimedia parse kara kara hitiye.. unge photos ganna.. denata 4000i ban save wela tiyenne.. mata 12000kage photos one mage wedeta..

    man wikiyen 1mins walata requests dekai denme.. denata awlak une.. na.. but copyrighted ewa filter karala thama save karaganne..

    mchn poddak kiyala dipanko bn ithn
     

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    use simple html dom php lib

    Not for PHP 5. oka parana library ekak machan. Memory leak issues thiyenawa. Oke clean() method eka call karath scope ekedi unset() karath eka fix karanna baha. Mata dawas dekakata kalinuth oka wuna. Cli eken pages 40,000k wage parse karanna giyama 2,000 wage giyama segmentation faults enawa.

    Php 5 wala Domdocumebt patta. Libxml based one extension ekak hodai.
     

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    mama oya wage scene ekak kara ban.. Wikipedia Wikimedia common walin... antimata mage PC eke blue screen enna patangatta dawas ganak on eke tibila..

    mage laga tiyenawa personal people info 1.2 million ganak.. births, deaths :P

    me tike Wikimedia parse kara kara hitiye.. unge photos ganna.. denata 4000i ban save wela tiyenne.. mata 12000kage photos one mage wedeta..

    man wikiyen 1mins walata requests dekai denme.. denata awlak une.. na.. but copyrighted ewa filter karala thama save karaganne..

    JSON/XML API ekek nadda? Blue screen enawa nam memory leak wenawa athi.

    Matath project ekak thibuna ban WiFi hotspot geolocate karanna. Bing Maps geocode karanna puluwan 30,000 per day. 1 million wage entries thibuna. Passe AWS EC2 instance ekaka cron dala run Kara. Bill eka 15,000 k witharai awa client ta. Eth awulak na wade wuna Elakiri wage. VPS ekaka ta dala.balanna.
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,714
    12,619
    113
    127.0.0.1:8080/Kandy
    JSON/XML API ekek nadda? Blue screen enawa nam memory leak wenawa athi.

    Matath project ekak thibuna ban WiFi hotspot geolocate karanna. Bing Maps geocode karanna puluwan 30,000 per day. 1 million wage entries thibuna. Passe AWS EC2 instance ekaka cron dala run Kara. Bill eka 15,000 k witharai awa client ta. Eth awulak na wade wuna Elakiri wage. VPS ekaka ta dala.balanna.


    Wiki unge jara api ekak tiyenne ban.. memory leak ekak newe machan HDD eke crash scene ekak awe man hithanne.. database eka patta size.. una.. thawam wede iwara na ban.. den tiyenne people' avatar eka ganna eka..

    itapasse mage quotes site ekak tiyenawa eke author biography ekata thama me tika one wenne..

    attachment.php



    attachment.php



    Menna me wage scene ekakata.. Quotes 80,000 wage tiyenawa.. Authors la 12,000 wage innawa..

    Site eka awrudu dekak witara run karala.. sell karala wat danna balanna one..
     

    Attachments

    • 1.JPG
      1.JPG
      41.7 KB · Views: 50
    • 2.JPG
      2.JPG
      55.2 KB · Views: 50