0

コード内に新しい PHP HTTP リクエストを作成する必要があります。json でエンコードされたデータの配列を返します。新しい HTTP リクエストを作成し、その場所にリダイレクトしないようにするにはどうすればよいですか?

ありがとう。

4

2 に答える 2

0

これはあなたが探しているものです: http://codular.com/curl-with-php

// Get cURL resource
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'http://stackoverflow.com'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
    curl_close($curl);


//For testing only
print_r('<pre>');
print_r($resp);die();
于 2013-05-02T00:20:22.413 に答える
0

json ファイルを取得して配列に入れようとしているとします。

$content = file_get_contents('http://www.example.com/test.json');
$json_array = json_decode($content);
print_r($json_array)
于 2013-05-01T23:26:05.463 に答える