UNSOLVED

canadian_tracke

updated

9 years ago

0

3016

August 11th, 2017 06:00

PHP script to create a directory and symlink

Good day!

I am trying to write a php script to create a directory then make a symlink to that directory.  So far, I cannot even get the directory created.  The authentication has even been simplified to rule that out.

Here is what I have. This script is trying to create the folder 'NewFolder'.    Any hints?

~snip~

$ch = curl_init();

$auth=base64_encode("username:password");

curl_setopt($ch, CURLOPT_URL, "https://media-vault:8080/namespace/ifs/home/username/NewFolder");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

curl_setopt($ch, CURLOPT_USERPWD, "username" . ":" . "password");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_setopt($ch, CURLOPT_PUT, true);

$headers = array();

$headers[] = "X-Isi-Ifs-Target-Type: container";

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

if (curl_errno($ch)) {

    echo "\nError:" . curl_error($ch) ."\n\n";

}

curl_close ($ch);