1

I need to perform a request to the following URL:

http://[USERNAME]:[PASSWORD]@[SERVER_IP]:[PORT]/some/path/to/some/file

BUT the finally generated URL is treated as INVALID because it contains the ':' character twice. Is there any solution?

That is what I tried:

$process = curl_init('http://[SERVER_IP]:[PORT]/OpenKM/webdav/okm:personal/somefile.mp4');
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERPWD, "[USERNAME]:[PASSWORD]");
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);  // $return is FALSE
var_dump(curl_error($process));die();  // Here we see string(23) "Empty reply from server"
0

1 Answer 1

6

Put encoded value of ':' instead, %3A

I suggest you to user URL Encoder tools widely available online, check one of them here...

http://meyerweb.com/eric/tools/dencoder/

Also here is complete char encoding list provided by w3school...

http://www.w3schools.com/tags/ref_urlencode.asp

Sign up to request clarification or add additional context in comments.

6 Comments

which of the two colons should be encoded? The links posted do not serve to convince me this is the correct answer.
I tried "[USERNAME]%3A[PASSWORD]" and even "okm%3Apersonal" instead of "okm:personal" but it did not help. Was that what you mean?
@JanDvorak check example given here in PHP manual php.net/manual/en/function.curl-init.php I hope it serves your purpose
@BogdanBurim no, only the second part, after the port onwards.
That helped. Thanks very much to everyone who helped me to find a solution. I hope other people will find this question usefull.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.