반응형


function get_content($url) {
  //$login_data = "void=loginChk&user_accountId=argethero&user_pwd=arget00&go_link=http://bang-joo.com"; 
  $login_data = "user=root&pass=djswpskgmlakd";
    $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)';
  $cookie_nm = "./cookie.txt";
    $curlsession = curl_init ();
    curl_setopt ($curlsession, CURLOPT_URL,             $url);
 // curl_setopt ($curlsession, CURLOPT_SSL_VERIFYPEER, FALSE);
 // curl_setopt ($curlsession, CURLOPT_SSLVERSION,1);
    curl_setopt ($curlsession, CURLOPT_HEADER,          0);
  //curl_setopt ($curlsession, CURLOPT_COOKIEJAR, $cookie_nm);
  //curl_setopt ($curlsession, CURLOPT_COOKIEFILE, $cookie_nm);   
    curl_setopt ($curlsession, CURLOPT_POST,            1);  
  curl_setopt ($curlsession, CURLOPT_POSTFIELDS, $login_data);  
    curl_setopt ($curlsession, CURLOPT_USERAGENT,       $agent);
    curl_setopt ($curlsession, CURLOPT_REFERER,         "");
    curl_setopt ($curlsession, CURLOPT_TIMEOUT,         30);
  curl_setopt ($curlsession, CURLOPT_RETURNTRANSFER, 1);

    $buffer = curl_exec ($curlsession);
    $cinfo = curl_getinfo($curlsession);
    curl_close($curlsession);

    /*if ($cinfo['http_code'] != 200)
    {
        return "";
    } */ 
   return $buffer;
}

반응형

'Web > PHP' 카테고리의 다른 글

www 붙이기 소스  (0) 2016.12.02
이번주 구하기  (0) 2012.02.06
엑셀 다운로드 헤더  (0) 2010.05.28
참조연산자 (&)  (0) 2010.04.29
php 4.x 버전과 php 5.x 버전 동시에 사용하기[리눅스 설정]  (0) 2010.04.01

+ Recent posts