function PostRequest($url) {
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Cookie: testcookie=blah; testcookie2=haha;'
)
);
//$context = stream_context_create($opts);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
return $result;
}
After I sent out the cookies, I still return by a message non login. but when I surf the pages with browser, I am login. I sent request with localhost then I tried to used ajax to sent the r开发者_如何学编程equest, but return status 0......
Is there any way to sent out the request?
If you want to play with HTTP scripting, i have library which you can use. https://github.com/toopay/CI-Proxy-Library, its orriginally written for CodeIgniter, but with little tweak, you should can use it on any PHP script.
精彩评论