Salve a tutti,
sto incontrando problemi nel contattare alcuni server esterni tramite librerie Curl.
Mi spiego meglio, nella stragrande maggioranza dei casi non ho problemi, i server esterni rispondono correttamente.
In alcuni casi, invece, ricevo un errore.
Ho ovviamente abilitato le funzioni server to server dalle impostazioni php.
Ora ho messo su un semplice script per testare il problema, il codice è il seguente:
Ora, se questo script è invocato dal mio sito altervista ricevo un messaggio d'errore:Codice:<?php function curl($url, $params) { $options = array(CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_USERAGENT => "MioSitoAltervista", // who am i CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect CURLOPT_TIMEOUT => 5, // timeout on response CURLOPT_POST => 1, // i am sending post data CURLOPT_POSTFIELDS => $params, // Post data ); $ch = curl_init($url); // Start the connection to $url curl_setopt_array($ch, $options); // Set the options above into the curl $content = curl_exec($ch); // Execute the connection with the options and retrieve the page curl_close($ch); // Close Connecion return $content; } echo curl("http://www.sitoditest.net/filediarrivo.php", "function=test"); ?>
Lo stesso script, identico, lanciato da un altro mio sito (residente su un altro host) restituisce invece esito positivo.Codice HTML:"Forbidden You don't have permission to access /filediarrivo.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
Ne desumo quindi che il problema sia in partenza e cioè da Altervista.
Sbaglio qualcosa o è un limite di Altervista?

LinkBack URL
About LinkBacks

