<div>php curl have a shit feature: can not post an empty http header, so if you want to perform a command like this in php:</div><div><br></div><div>swift -A <a href="http://10.38.10.127:8080/auth/v1.0">http://10.38.10.127:8080/auth/v1.0</a> -U AUTH_testa27:AUTH_testu27 -K testp post <font class="Apple-style-span" color="#ff0000">-r ' '</font> mycontainer2</div>
<div><br></div><div>the "X-Container-Read" will not be send, so you can not make a container unpublic from public</div><div><br></div><div>i write an example code to show how make it work with php, just use ' not " and plus \n at the end</div>
<div><br></div><div>hope can make some help</div><div><br></div><div><br></div><div><?php</div><div><br></div><div>    $prefix = "AUTH_";</div><div>    $account_name = $prefix."testa27";</div><div>    $user_name = $prefix."testu27";</div>
<div>    $user_pass = "testp";</div><div>    $container = "mycontainer2";</div><div>    $user_token = "AUTH_tkb21f5fcfea144cf9a99ed1de9a577db2";</div><div>    $path = "/v1/".$account_name."/".$container;</div>
<div><br></div><div><br></div><div>    #if you want to make container public use this</div><div>    #$http_headers = array("X-Auth-Token: ".$user_token, 'X-Container-Read: .r:*');</div><div><br></div><div>
    #if you want to make container not public use this</div><div>    $http_headers = array("X-Auth-Token: ".$user_token, 'X-Container-Read: \n');</div><div><br></div><div>    print_r($http_header);</div>
<div><br></div><div>    $ch = curl_init();</div><div><br></div><div>    curl_setopt($ch, CURLOPT_URL, "<a href="http://10.38.10.127:8080">http://10.38.10.127:8080</a>".$path);</div><div>    curl_setopt($ch, CURLOPT_POST, 1);</div>
<div>    curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);</div><div>    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</div><div>    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);</div><div>    curl_setopt($ch, CURLINFO_HEADER_OUT, true);</div>
<div><br></div><div>    print "test set container public\n";</div><div><br></div><div>    curl_exec($ch);</div><div><br></div><div>    $headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);</div><div><br></div><div>
    print_r($headers);</div><div><br></div><div>    if (!curl_errno($ch))</div><div>    {</div><div>        $info = curl_getinfo($ch);</div><div><br></div><div>        if ((int)($info['http_code'] / 100) != 2)</div>
<div>        {</div><div>            print "set container public return error ".$info['http_code']."\n";</div><div>            return -1;</div><div>        }</div><div>    }</div><div>    else</div>
<div>    {</div><div>        print "set container public error\n";</div><div>        return -2;</div><div>    }</div><div><br></div><div>    curl_close($ch);</div><div><br></div><div>?></div>