Any way to keep curl's cookies in memory and not on disk

前端 未结 6 530
-上瘾入骨i
-上瘾入骨i 2020-12-01 09:09

I\'m doing some cURL work in php 5.3.0.

I\'m wondering if there is any way to tell the curl handle/object to keep the cookies in memory (assuming I\'m reusing the sa

6条回答
  •  我在风中等你
    2020-12-01 10:00

    Unfortunately, I don't think you can use 'php://memory' as the input and output stream. The workaround is to parse the headers yourself. This can be done pretty easily. Here is an example of a page making two requests and passing the cookies yourself.

    curl.php:

    
    

    test.php:

    
    

    This will output 'Hello!' on the second request.

提交回复
热议问题