繁体   English   中英

在php脚本中获取网站请求

[英]get request for a website in a php script

我想在这样的网站上获得请求

$id = "something";
$response = http_get("http://example.com?id=$id, array("timeout"=>1), $out);

我没有找到如何完全使用http_get

我试过了file_get_contents,它像

$out = file_get_contents("http://www.example.com?id=something");

但我想要那样

$out = file_get_contents("http://www.example.com?id=$id");

这一个不起作用

我使用它的方法是使用下面的代码。

$out = file_get_contents("http://www.example.com?id=".$id);

这会将$ id变量内容连接到要请求的url末尾。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM