본문 바로가기
programming/php

stream_context_create

by hotdogya 2012. 4. 10.

http://www.php.net/manual/en/function.file-get-contents.php


<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example.com/', false, $context);
?>


stream_context_create() 컨텍스트 옵션을 추가할 수 있다.

'programming > php' 카테고리의 다른 글

php 문자열 찾기 함수  (0) 2012.04.29