Results 1 to 3 of 3

Thread: cURL not returning anything. Using a whitelisted server connection

  1. #1
    mgibson is offline Junior Member
    Join Date
    Jan 2016
    Posts
    4

    Default cURL not returning anything. Using a whitelisted server connection

    Code:
    <html lang="en">
    <head>
    	<title>Document</title>
    </head>
    <body>
    	<?php
    		ini_set("display_errors","On");
    		error_reporting (E_ALL);
    
    
    		$state = $_POST["state"];
    		$city = $_POST["city"];
    
    		//$url = "http://api.wunderground.com/api/0d0cf4a823e2a1f9/conditions/q/" . $state . "/" . $city . ".json";
    
    		//Just as a test...
    		$url = "http://blog.altervista.org/";
    
    		$ch = curl_init();
    
    		curl_setopt($ch, CURLOPT_URL, $url);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            curl_setopt($ch, CURLOPT_SSLVERSION,3);
            
            $tmp = curl_exec($ch);
    
    		echo curl_error($ch);
    
    		echo $tmp;
    		
    		curl_close($ch);
    		//$obj = json_decode($result);
    	?>
    <br>
    
    <?php
    	echo $url;
    ?>
    
    
    </body>
    </html>
    Returns no text and no errors (unless I use a server not on whitelist).

    Also get no output using file_get_contents...

  2. #2
    mgibson is offline Junior Member
    Join Date
    Jan 2016
    Posts
    4

    Default

    Problem was in fact that I needed to be using https. I tried with other URLS and it worked.

  3. #3
    karl94 is offline AlterVista Staff
    Join Date
    Jan 2015
    Posts
    573

    Default

    So, did you solve? Is it working now?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO