示例#1
0
function weibo_post($arg1, $arg2)
{
    echo "arg1:" . $arg1 . "----arg2:" . $arg2 . "<br/>";
    $handle = curl_init(initWBUrl($arg1, $arg2));
    echo initWBUrl($arg1, $arg2);
    curl_setopt($handle, CURLOPT_POST, true);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
    $ret = curl_exec($handle);
    print_r($ret);
    curl_close($handle);
}
示例#2
0
function weibo_post($arg1, $arg2)
{
    echo "arg1:" . $arg1 . "----arg2:" . $arg2 . "<br/>";
    $handle = curl_init(initWBUrl($arg1, urlencode($arg2)));
    echo initWBUrl($arg1, urlencode($arg2));
    curl_setopt($handle, CURLOPT_POST, true);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
    $ret = curl_exec($handle);
    print_r($ret);
    curl_close($handle);
    //with illegal website, so rePost
    sleep(2);
    $retObj = json_decode($ret);
    if ($retObj->{'error_code'} == 20018) {
        echo "<br/>\n error invalid net address <br/>\n";
        $arg2 = preg_replace("/http:\\S*/", "", $arg2);
        weibo_postAgain($arg1, $arg2);
    } else {
        echo "<br/>\n error not illegal website <br/>\n";
    }
}