PHP,CURL,HTTP REQEST

Lokka Baba

Well-known member
  • May 11, 2014
    3,365
    888
    113
    මගේ කාමරේ
    Lamyi help ekak dendo

    Mn php walata aluth but programming dannwa tikak js,css,jquery tika tika dannwa, ppodi wadak set una API ekak hadanna,mata oni machanla http request ekakin site ekakata log wela ake thyna table data wagyk ganna(meka thama site eka www.investnextdoor.com),i hve no idea, so help me , highly appreciated your help,theruwan saranyi
     

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    Ube requirement eka pahadili na...pahadiliwa kiyapan..help karannam...

    Dan oya site eke API ekak thiyenawada? eke API eken dena data da ganna ona?

    Php wala thiyenwa curl kiyala module ekak..eka use karapan,,,ehema naththam file_get_contents() kiyala function ekak thiyenawa,,habai meka godak servers wala block karala thiyenne...mama nam recoomend karanne curl :yes:
     

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    mu kiyanne scarper ekak hadanna newe,, API ekak hadanna

    API ekak hadanwa kiyana ekai, API ekakin data gannawa kiyannei dekak machan...mama danne na uba mewa dannawada kiyala..habai aru kiyala thiyena scraper seen eka waradi na..mokada me kiyala thiyena widihata penne uta one ara site eka scarpe karala eke thiyena data tikak ganna..:yes: mokada ara dala thiyena site eke API ekak nam penna na..
     

    Lokka Baba

    Well-known member
  • May 11, 2014
    3,365
    888
    113
    මගේ කාමරේ
    thnx machnla reply kalata
    site ake api nha kollo
    mta one machanla mn dala thyna site ekata log wenna oni issellma curl walin
    site ekata log wela wena page ekakta redirect wenna oni
    ake table ekaka data wagyk thynwa mata a tika ganna one danta
     

    Lokka Baba

    Well-known member
  • May 11, 2014
    3,365
    888
    113
    මගේ කාමරේ
    API ekak hadanwa kiyana ekai, API ekakin data gannawa kiyannei dekak machan...mama danne na uba mewa dannawada kiyala..habai aru kiyala thiyena scraper seen eka waradi na..mokada me kiyala thiyena widihata penne uta one ara site eka scarpe karala eke thiyena data tikak ganna..:yes: mokada ara dala thiyena site eke API ekak nam penna na..

    danne naha bn udin pallen dannwa :baffled::baffled::baffled::baffled:
    kyla dipalla :D:D:D:D:D:D
     

    Banned!

    Member
    Jun 30, 2013
    10,779
    1,070
    0
    API ekak hadanwa kiyana ekai, API ekakin data gannawa kiyannei dekak machan...mama danne na uba mewa dannawada kiyala..habai aru kiyala thiyena scraper seen eka waradi na..mokada me kiyala thiyena widihata penne uta one ara site eka scarpe karala eke thiyena data tikak ganna..:yes: mokada ara dala thiyena site eke API ekak nam penna na..

    pora post eke kiyala thiyenne API ekak hadanna (api walin data ganna newe) , hodata kiyawapan, ekai ehema kiwe, math scarper project karala thiyenawa, api ewath karala thiyenawa
     

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    thnx machnla reply kalata
    site ake api nha kollo
    mta one machanla mn dala thyna site ekata log wenna oni issellma curl walin
    site ekata log wela wena page ekakta redirect wenna oni
    ake table ekaka data wagyk thynwa mata a tika ganna one danta


    Hapuchchiye....log wennath onada? oka public access karanna nadda? log wenna puluwan curl eken..eth kathandara.site eka gana idea ekak nathuwa ehema kiyanna amarui ban..login ekak thiyenawanam ewapan balanna...
     

    mldarshana

    Well-known member
  • Apr 2, 2007
    34,059
    1,404
    113
    ආශ්චර්ය අභියස :nerd:
    PHP CURL walin karanna puluwan

    PHP:
    $username = 'user';
    $password = 'pass';
    $loginUrl = 'http://www.remote-domain.com/login.php';
     
    //init curl
    $ch = curl_init();
     
    //Set the URL to work with
    curl_setopt($ch, CURLOPT_URL, $loginUrl);
     
    // ENABLE HTTP POST
    curl_setopt($ch, CURLOPT_POST, 1);
     
    //Set the post parameters
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'user='.$username.'&pass='.$password);
     
    //Handle cookies for the login
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
     
    //Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
    //not to print out the results of its query.
    //Instead, it will return the results as a string return value
    //from curl_exec() instead of the usual true/false.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
    //execute the request (the login)
    $store = curl_exec($ch);
     
    //the login is now done and you can continue to get the
    //protected content.
     
    //set the URL to the protected file
    curl_setopt($ch, CURLOPT_URL, 'http://www.remote-domain.com/member/data');
     
    //execute the request
    $content = curl_exec($ch);
     

    Lokka Baba

    Well-known member
  • May 11, 2014
    3,365
    888
    113
    මගේ කාමරේ
    web page src eka balal hoyagaththe bn login eka

    net ake balala thatamala liwa curl walin balapn senn eka poddak
    cookie gana mta awabodyak naha bn

    $url="https://www.investnextdoor.com/wp-login.php";
    $postinfo = "log=".$username."&pwd=".$password;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_NOBODY, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);

    curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER["HTTP_USER_AGENT"]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
    curl_exec($ch);

    curl_setopt($ch, CURLOPT_URL, "https://www.investnextdoor.com/marketplace/");
    $html = curl_exec($ch);

    mn server ekak wada karanne
    mata kypn cookie seen eka goda danne kohomada
     

    Lokka Baba

    Well-known member
  • May 11, 2014
    3,365
    888
    113
    මගේ කාමරේ
    PHP CURL walin karanna puluwan

    PHP:
    $username = 'user';
    $password = 'pass';
    $loginUrl = 'http://www.remote-domain.com/login.php';
     
    //init curl
    $ch = curl_init();
     
    //Set the URL to work with
    curl_setopt($ch, CURLOPT_URL, $loginUrl);
     
    // ENABLE HTTP POST
    curl_setopt($ch, CURLOPT_POST, 1);
     
    //Set the post parameters
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'user='.$username.'&pass='.$password);
     
    //Handle cookies for the login
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
     
    //Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
    //not to print out the results of its query.
    //Instead, it will return the results as a string return value
    //from curl_exec() instead of the usual true/false.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
    //execute the request (the login)
    $store = curl_exec($ch);
     
    //the login is now done and you can continue to get the
    //protected content.
     
    //set the URL to the protected file
    curl_setopt($ch, CURLOPT_URL, 'http://www.remote-domain.com/member/data');
     
    //execute the request
    $content = curl_exec($ch);

    thnx machn:D:D:D
    oka baluwa kollo mata cookie handle karanda thma therenne naththe :baffled::baffled::baffled: