Örnek twitter App

3 Cevap

Ben artık bir web barındırma hizmeti kodumu çalıştırıyorum http://xtreemhost.com/

<?php 
function updateTwitter($status)
{ 
    $username = 'xxxxxx'; 
    $password = 'xxxx';
    $url = 'http://api.twitter.com/1/statuses/update.xml'; 
    $postargs = 'status='.urlencode($status); 
    $responseInfo=array(); 
    $ch = curl_init($url);

    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_POST, true); 
    // Give CURL the arguments in the POST 
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
    // Set the username and password in the CURL call 
    curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password); 
    // Set some cur flags (not too important) 
    $response = curl_exec($ch); 
    if($response === false)
{
    echo 'Curl error: ' . curl_error($ch);
}
else
{
    echo 'Operation completed without any errors<br/>';
}

    // Get information about the response 
    $responseInfo=curl_getinfo($ch); 
    // Close the CURL connection curl_close($ch);
    // Make sure we received a response from Twitter 
    if(intval($responseInfo['http_code'])==200){ 
        // Display the response from Twitter 
        echo $response; 
    }else{ 
        // Something went wrong 
        echo "Error: " . $responseInfo['http_code']; 
    } 
curl_close($ch);
    }

updateTwitter("Just finished a sweet tutorial on http://brandontreb.com");

?>

Ben şimdi aşağıdaki hatayı alıyorum

Curl error: Couldn't resolve host 'api.twitter.com' 
Error: 0

Biri benim sorunu çözmek Lütfen

3 Cevap

Ben onlar bu alanı engelleyen düşünüyorum ama workaround by using twitter.com's IP address yerine etki alanı adının başardı, xtreemhost.com 'un ücretsiz hosting kullanarak aynı hata geldi.

Sen konağın DNS bozuk görünüyor. Teknik desteği arayın.

tamam ben ücretsiz host thats düşünüyorum

(hatta her) Ücretsiz Web Alanı Host çoğu curl veya fsockopen/pfscokopen gibi php ağ işlevlerini devre dışı bırakın. Çünkü safe_mode paylaşılan ana güvenlik sorunlarını gidermek için çalıştığı thats.

tamam onun PHP düzeyde bu sorunu çözmek için denemek için mimari yanlış, ama web sunucusu ve işletim sistemi seviyesindeki alternatifler çok gerçekçi değildir, çünkü birçok kişi, özellikle Ücretsiz Web Alanı Hosts, şimdi için güvenli modu kullanabilirsiniz.