"No Route to host" error, but only with php

Hey Everyone,

Bit of a weird issue. I installed own host on a PAAS plan. for the most part it is running well. However I keep getting a “no route to host” error when I try and use curl_setopt within php.

Here is my exact code:

`    function uploadToOwncloud($args = array()){
        $uploadPath     = $args['uploadPath'];
        $product_data   = fopen('php://memory', 'r+');
        fputs($product_data, $args['product_data']);
        rewind($product_data);

        $user           = $args['user'];
        $pass           = $args['pass']; 
        $url              = $args['url']."/remote.php/webdav" .urlencode($uploadPath);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://env-1577843.ca-east.onfullhost.cloud/remote.php/webdav$uploadPath");
        curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass");
        curl_setopt($ch, CURLOPT_PUT, 1);
        
        curl_setopt($ch, CURLOPT_INFILE, $product_data);
        curl_setopt($ch, CURLOPT_INFILESIZE, fstat($product_data)['size']);
        
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
        
        $curl_response_res = curl_exec ($ch);
        var_export(curl_error($ch));
        return;
    }`

I keep getting a “Failed to connect to url.com port 80: No route to host”

Here is two strang things.

  1. I had this exact code running fine when owncloud has installed on my shared hosting, and it worked fine.
  2. I tried this on the terminal of my mac "curl -u “user:password” -T test.txt “http://sameurlasphpscript.com/remote.php/webdav/text.txt” and it works fine

Any thoughts?

I’m fairly new to ownCloud and this doesn’t look like a question for an ownCloud support forums to me because it looks like a networking topic.