$file_name_with_full_path = $this->image_dir.$list[$i]['img_name'].'.jpeg;type=image/jpeg'; //타입형 적어둘것
$data = array(
'title' =>'test',
'userfile1' =>'@'.$file_name_with_full_path, << 파일전송시 앞에 @붙일것
);
$fp = fopen($this->cookie_dir."tmp", "w");
$this->curl = curl_init();
$headers[] = "Content-Type:multipart/form-data"; << 헤더에 멀티파트/폼데이터 추가할것
$options = array(
CURLOPT_HTTPHEADER=>$headers,
CURLOPT_URL=> 'http',
CURLOPT_POST=> TRUE,
CURLOPT_COOKIEJAR=> $this->cookie_dir."cookie",
CURLOPT_COOKIEFILE=> $this->cookie_dir."cookie",
CURLOPT_HEADER=> TRUE,
CURLOPT_FOLLOWLOCATION=> TRUE,
CURLOPT_POSTFIELDS=>$data,
CURLOPT_REFERER=>'https://wecolle.jp/business/fair/input/',
CURLOPT_RETURNTRANSFER=> TRUE,
CURLOPT_WRITEHEADER=> $fp,
CURLOPT_USERAGENT=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0',
);
$q = http_build_query($data); <<이건 멀티파트 전송시에 사용하면 안됨 전송이 안됨.
'<개인공부 - private study> > [PHP]' 카테고리의 다른 글
smarty 기초 (0) | 2014.03.28 |
---|---|
php -> excel로 변경 (0) | 2013.12.03 |
php 알아두면 좋은것 (0) | 2013.11.27 |