示例#1
0
文件: url.php 项目: easunlee/MT-copy
function _fopen_urlopen($url, $postdata, &$response, $file_name, $file_field)
{
    $params = array();
    if ($file_name && $file_field) {
        $boundary = '----------' . md5(time());
        $content = get_post_content($boundary, $postdata, $file_name, $file_field);
        $header = get_http_headers_for_request($boundary, $content, $file_name, $file_field);
        $params = array('http' => array('method' => 'POST', 'header' => $header, 'content' => $content));
    } else {
        if ($postdata) {
            $params = array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => get_query_string($postdata)));
        }
    }
    ini_set('user_agent', USER_AGENT);
    $ctx = stream_context_create($params);
    $fp = fopen($url, 'rb', false, $ctx);
    if (!$fp) {
        return false;
    }
    // Get status code from headers.
    list($unused, $response['code'], $unused) = explode(' ', $http_response_header[0], 3);
    $headers = array_slice($http_response_header, 1);
    // Convert headers into associative array.
    foreach ($headers as $unused => $header) {
        $header = explode(':', $header);
        $header[0] = trim($header[0]);
        $header[1] = trim($header[1]);
        $headers[strtolower($header[0])] = strtolower($header[1]);
    }
    $response['data'] = stream_get_contents($fp);
}
示例#2
0
<form name="writeform" method="POST" action="updateandcontinue.php" enctype="multipart/form-data">
<?php 
//if(!isset($editid)){$editid = 1;}
if (isset($_GET['id'])) {
    $editid = $_GET['id'];
    $post = get_post_content($editid);
    //pretty($post);
    ?>
	
	

<div id="tabs">
	<ul>
		<li><a href="#tabs-1">Body Element</a></li>
		<li><a href="#tabs-2">Category</a></li>
		<li><a href="#tabs-3">Comments (<?php 
    echo get_comment_nb($_GET['id']);
    ?>
)</a></li>
		<li><a href="#tabs-4">History
		<?php 
    if (!empty($post['note'])) {
        echo '(' . str_word_count($post['note']) . ' words)';
    } else {
        echo 'Empty';
    }
    ?>

		</a></li>		
		<li><a href="#tabs-5">Ping</a></li>
	</ul>
示例#3
0
    </section>
    <!-- end content -->
    <?php 
    }
} else {
    ?>
    <?php 
}
?>

    <?php 
/* Start the Loop */
$query = new WP_Query(array('post__not_in' => array($post->ID)));
?>
    
    <?php 
while ($query->have_posts()) {
    $query->the_post();
    ?>
        <?php 
    get_post_content();
    ?>
    <?php 
}
?>




<?php 
get_footer();