PHP变量获取

标签 php mysql file-get-contents

我一直致力于让某些事情发挥作用。基本上我希望能够执行 file.php?ip=132.123.123.123&port=28005

基本上我希望 filegetcontents 嵌入文本

enter image description here

是我想要的(由于语法错误而显示离线,因为我无法获取它何时在线,它以纯文本在线/离线返回

Print "<td>".file_get_contents("http://www.domain.com/status.php?ip=".$ip?port=.$port);" </td></tr>";

它从数据库中获取IP和端口,状态检查器检查file.php?ip=132.123.123.123&port=28005

<小时/>

在执行此操作时,我收到此错误

[03-Jan-2014 03:46:14 UTC] PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to udp://123.123.123.123?port=28035:0 (Failed to parse address &quot;123.123.123.123?port=28035&quot;) in /home/*/public_html/servers/status.php on line 5

我使用的线路

Print "<td>".file_get_contents("http://www.domain.me/servers/status.php?ip=".$info['ip']."?port=".$info['port']) ." </td></tr>";

最佳答案

您有多个引用问题和错误的分号:

Print "<td>".file_get_contents("http://www.domain.com/status.php?ip=".$ip?port=.$port);" </td></tr>";

应该是

Print "<td>".file_get_contents("http://www.domain.com/status.php?ip=".$ip."?port=".$port) ." </td></tr>";

一个像样的文本编辑器会捕获引用问题,而 IDE 会捕获分号问题。

至于创建表,这取决于从 file_get_contents() 返回的数据的格式。对这些数据执行 var_dump() 并查看其格式,以便您可以计划如何制作表格。

$data = file_get_contents("http://www.domain.com/status.php?ip=".$ip."?port=".$port);
var_dump($data);

关于PHP变量获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20895010/

相关文章:

php - 2 个供应商包 : laravel and lumen 使用的相同命名空间

php - 是否有与 PDO::FETCH_CLASS 等效的 INSERT 或 UPDATE?

php - 在 php 中使用 file_get_content 时如何保留缩进?

file-get-contents - PHP 将大的二进制文件转换为可读文件

php - PHP OOP 中的未定义属性错误消息

PHP- file_get_contents 无法打开流 : Connection refused

php - Magento 中过滤器搜索时的自定义网格中未返回产品名称

php - 是否可以用已知盐攻击用户密码

Mysql在多个数据库中运行一个脚本

mysql - 我们可以使用列的 order by 而不使用该列的 group by 来编写 oracle 查询吗