parse_str不能正常工作?

时间:2012-04-19 07:25:03

标签: php parsing url character

我正在开发的应用程序有一个非常奇怪的问题,应用程序的作用是从另一个站点获取数据并将其很好地显示给用户,数据位于此处(这是我的个人资料):< / p>

http://fairview.deadfrontier.com/onlinezombiemmo/get_values.php?userID=2667244

如您所见,该页面看起来像一个巨大的查询字符串。问题只在于一个变量“newpms”(几乎位于最后)。

这是获取所有变量及其值的代码,我正在使用parse_str():

$url = "http://fairview.deadfrontier.com/onlinezombiemmo/get_values.php?userID=2667244";
$sc = file_get_contents($url);
$str = parse_str(trim($sc));

// wrong value
print $newpms.PHP_EOL;

// examples that show the correct value
print $account_name.PHP_EOL;
print $df_buyer.PHP_EOL;

即使网站显示变量newpms在我这边大于0它总是显示为0,它的价值也无关紧要。我真的不明白这种行为。

即使我使用的是这样,它也不起作用:

$url = "http://fairview.deadfrontier.com/onlinezombiemmo/get_values.php?userID=2667244";
$sc = file_get_contents($url);
$data = array();
$str = parse_str(trim($sc), $data);

print_r($data);

这将产生(仅显示newpms):

  

[newpms] =&gt; 0

也许file_get_contents正在检索错误的内容?

由于

0 个答案:

没有答案