可能重複:
get the value of an url response with curl如何在php中使用curl?
我已經stores.php現在我想看看使用curl這個頁面的輸出的PHP頁面名稱,我能做些什麼? 我的代碼是迄今stores.php頁
<?php
include_once '../application/Boot.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$body = @file_get_contents('php://input');
$json = json_decode($body, true);
if (isset($json['version'])) {
$client_cache_version = @$json['version'];
$sql = $db->quoteInto("SELECT * FROM stores where version_modified > ". $client_cache_version);
$results = $db->fetchAll($sql);
$version_sql = $db->quoteInto("SELECT max(version_modified) as version FROM stores");
$version_results = $db->fetchAll($version_sql);
$count = array(
'count' => sizeof($results)
);
array_push($results, $version_results['0']);
array_push($results, $count);
//ob_start("ob_gzhandler");
header('HTTP/1.1 200 Stores list');
echo json_encode($results);
exit;
}else {
header('HTTP/1.1 400 Bad Request');
exit;
}
}else{
header('HTTP/1.1 400 Bad Request');
exit;
}
?>
(OS ,...)你想使用curl來顯示腳本的響應? – scube
重複? http://stackoverflow.com/q/2001897/508702 –
@scube :) os是linux(ubuntu) – John