- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我从某人那里得到了地址和端口号。我正在发送一个叫做“tagstream”的东西,然后收到一个响应,一个 zpl 标签。
我应该通过套接字连接发送这个标签流来触发“Uni-Box”。我试过用 curl 来做这个。它有效,但我需要大约 10 秒才能收到回复。
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '87.213.39.202');
curl_setopt($ch, CURLOPT_PORT, 3032);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $message);
$zpl = curl_exec($ch);
curl_close($ch);
这是我从 curl_getinfo() 返回的内容:
array:26 [▼
"url" => "HTTP://87.213.39.202/"
"content_type" => null
"http_code" => 0
"header_size" => 0
"request_size" => 538
"filetime" => -1
"ssl_verify_result" => 0
"redirect_count" => 0
"total_time" => 10.327
"namelookup_time" => 0.0
"connect_time" => 0.031
"pretransfer_time" => 0.031
"size_upload" => 410.0
"size_download" => 8598.0
"speed_download" => 832.0
"speed_upload" => 39.0
"download_content_length" => -1.0
"upload_content_length" => 410.0
"starttransfer_time" => 0.062
"redirect_time" => 0.0
"redirect_url" => ""
"primary_ip" => "87.213.39.202"
"certinfo" => []
"primary_port" => 3032
"local_ip" => "192.168.1.136"
"local_port" => 49948
]
我还通过这个程序测试了连接: http://sockettest.sourceforge.net/
当我使用它时,我会立即收到回复。
我用 xdebug 做了跟踪:
TRACE START [2015-11-24 10:43:47]
0.0010 130056 -> {main}() C:\Users\phpmachine\test.php:0
0.0010 130696 -> curl_init() C:\Users\phpmachine\test.php:4
0.0010 131600 -> curl_setopt() C:\Users\phpmachine\test.php:5
0.0010 131576 -> curl_setopt() C:\Users\phpmachine\test.php:6
0.0010 131576 -> curl_setopt() C:\Users\phpmachine\test.php:7
0.0010 131576 -> curl_setopt() C:\Users\phpmachine\test.php:9
0.0010 131576 -> curl_setopt() C:\Users\phpmachine\test.php:11
0.0010 131544 -> curl_setopt() C:\Users\phpmachine\test.php:12
0.0010 131512 -> curl_exec() C:\Users\phpmachine\test.php:14
10.3476 153384 -> curl_getinfo() C:\Users\phpmachine\test.php:15
10.3476 156232 -> var_dump() C:\Users\phpmachine\test.php:17
10.3516 8416
TRACE END [2015-11-24 10:43:58]
我从进程监视器那里得到了这个:
12:23:34,0427525 php.exe 6052 TCP Accept phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 0, mss: 1440, sackopt: 1, tsopt: 0, wsopt: 1, rcvwin: 8192, rcvwinscale: 8, sndwinscale: 8, seqnum: 0, connid: 0
12:23:34,0430792 php.exe 6052 TCP Accept phpmachine-PC:8001 -> phpmachine-PC:52117 SUCCESS Length: 0, mss: 1440, sackopt: 1, tsopt: 0, wsopt: 1, rcvwin: 8192, rcvwinscale: 8, sndwinscale: 8, seqnum: 0, connid: 0
12:23:34,0481570 php.exe 6052 TCP TCPCopy phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 1052, seqnum: 0, connid: 0
12:23:34,0481705 php.exe 6052 TCP Receive phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 1052, seqnum: 0, connid: 0
12:23:34,0485330 php.exe 6052 CreateFile C:\Users\phpmachine SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:34,0485752 php.exe 6052 QueryDirectory C:\Users\phpmachine\test.php SUCCESS Filter: test.php, 1: test.php
12:23:34,0486250 php.exe 6052 CloseFile C:\Users\phpmachine SUCCESS
12:23:34,0490208 php.exe 6052 CreateFile C:\Users\phpmachine SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:34,0490670 php.exe 6052 QueryNetworkOpenInformationFile C:\Users\phpmachine SUCCESS CreationTime: 5-11-2014 20:57:57, LastAccessTime: 24-11-2015 11:04:43, LastWriteTime: 24-11-2015 11:04:43, ChangeTime: 24-11-2015 11:04:43, AllocationSize: 1-1-1601 1:00:00, EndOfFile: 1-1-1601 1:00:00, FileAttributes: D
12:23:34,0490802 php.exe 6052 CloseFile C:\Users\phpmachine SUCCESS
12:23:34,0491815 php.exe 6052 CreateFile C:\Users\phpmachine\test.php SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened
12:23:34,0492591 php.exe 6052 QueryInformationVolume C:\Users\phpmachine\test.php BUFFER OVERFLOW VolumeCreationTime: 31-10-2014 0:44:17, VolumeSerialNumber: 1C6C-4C1A, SupportsObjects: True, VolumeLabel: Win
12:23:34,0492742 php.exe 6052 QueryAllInformationFile C:\Users\phpmachine\test.php BUFFER OVERFLOW CreationTime: 24-11-2015 10:44:39, LastAccessTime: 24-11-2015 10:44:39, LastWriteTime: 24-11-2015 11:41:30, ChangeTime: 24-11-2015 11:41:30, FileAttributes: A, AllocationSize: 4.096, EndOfFile: 911, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0xb000000023920, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word
12:23:34,0492939 php.exe 6052 CreateFileMapping C:\Users\phpmachine\test.php FILE LOCKED WITH ONLY READERS SyncType: SyncTypeCreateSection, PageProtection:
12:23:34,0493072 php.exe 6052 QueryStandardInformationFile C:\Users\phpmachine\test.php SUCCESS AllocationSize: 4.096, EndOfFile: 911, NumberOfLinks: 1, DeletePending: False, Directory: False
12:23:34,0493284 php.exe 6052 CreateFileMapping C:\Users\phpmachine\test.php SUCCESS SyncType: SyncTypeOther
12:23:34,0493580 php.exe 6052 QueryStandardInformationFile C:\Users\phpmachine\test.php SUCCESS AllocationSize: 4.096, EndOfFile: 911, NumberOfLinks: 1, DeletePending: False, Directory: False
12:23:34,0494642 php.exe 6052 CloseFile C:\Users\phpmachine\test.php SUCCESS
12:23:34,0764135 php.exe 6052 TCP Connect phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 0, mss: 1460, sackopt: 1, tsopt: 0, wsopt: 1, rcvwin: 65700, rcvwinscale: 8, sndwinscale: 0, seqnum: 0, connid: 0
12:23:34,1108071 php.exe 6052 TCP Send phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 626, startime: 112255, endtime: 112256, seqnum: 0, connid: 0
12:23:34,1115333 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 128, seqnum: 0, connid: 0
12:23:34,1115718 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 128, seqnum: 0, connid: 0
12:23:34,3219629 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3220048 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3392041 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3392469 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3400457 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3400661 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3689893 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3690216 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3696465 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1256, seqnum: 0, connid: 0
12:23:34,3696662 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1256, seqnum: 0, connid: 0
12:23:34,3766311 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,3766508 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 1460, seqnum: 0, connid: 0
12:23:34,4040472 php.exe 6052 TCP TCPCopy phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 150, seqnum: 0, connid: 0
12:23:34,4040780 php.exe 6052 TCP Receive phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 150, seqnum: 0, connid: 0
12:23:44,3904869 php.exe 6052 CreateFile C:\Users SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:44,3905414 php.exe 6052 QueryDirectory C:\Users\phpmachine SUCCESS Filter: phpmachine, 1: phpmachine
12:23:44,3906037 php.exe 6052 CloseFile C:\Users SUCCESS
12:23:44,3906877 php.exe 6052 CreateFile C:\ SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:44,3907428 php.exe 6052 QueryDirectory C:\Users SUCCESS Filter: Users, 1: Users
12:23:44,3908402 php.exe 6052 CloseFile C:\ SUCCESS
12:23:44,3910462 php.exe 6052 CreateFile C:\Users\phpmachine SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
12:23:44,3911072 php.exe 6052 QueryNetworkOpenInformationFile C:\Users\phpmachine SUCCESS CreationTime: 5-11-2014 20:57:57, LastAccessTime: 24-11-2015 11:04:43, LastWriteTime: 24-11-2015 11:04:43, ChangeTime: 24-11-2015 11:04:43, AllocationSize: 1-1-1601 1:00:00, EndOfFile: 1-1-1601 1:00:00, FileAttributes: D
12:23:44,3911278 php.exe 6052 CloseFile C:\Users\phpmachine SUCCESS
12:23:44,3917083 php.exe 6052 TCP Send phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 125, startime: 112358, endtime: 112358, seqnum: 0, connid: 0
12:23:44,3918207 php.exe 6052 TCP Send phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 723, startime: 112358, endtime: 112358, seqnum: 0, connid: 0
12:23:44,3925080 php.exe 6052 TCP Disconnect phpmachine-PC:8001 -> phpmachine-PC:52117 SUCCESS Length: 0, seqnum: 0, connid: 0
12:23:44,3935677 php.exe 6052 TCP Disconnect phpmachine-PC:8001 -> phpmachine-PC:52116 SUCCESS Length: 0, seqnum: 0, connid: 0
12:23:44,4195232 php.exe 6052 TCP Disconnect phpmachine-PC:52118 -> gateway.gls-netherlands.com:3032 SUCCESS Length: 0, seqnum: 0, connid: 0
12:23:48,4995571 php.exe 6052 Thread Exit SUCCESS Thread ID: 5964, User Time: 0.0000000, Kernel Time: 0.0000000
12:23:48,4996301 php.exe 6052 Thread Exit SUCCESS Thread ID: 5708, User Time: 0.0000000, Kernel Time: 0.0000000
我找到了一些可行的方法,但不确定它是否是最佳方法。
这次没有使用 curl。如果我在没有任何内容可读时使用 socket_read,则再次需要 10 秒才能获得结果。但我知道收到的消息应该以哪些字符结尾,所以我用它来确定何时停止。
它有效,而且现在花费的时间更少了!
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($socket, '87.213.39.202', 3032);
socket_write($socket, $message, strlen($message));
$result = '';
$zpl = '';
for($i = 0; $i < 10; $i++) {
$read = socket_read($socket, 2048);
$zpl = $zpl . $read;
if(substr($read, -13) == '/////GLS/////') {
break;
}
}
socket_close($socket);
最佳答案
HTTP
与 http
"http_code"=> 0
- 这意味着请求期间发生了错误,甚至还没有完成。关于php - curl - react 慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33889435/
我以前从未做过任何 curl ,所以需要一些帮助。我试图从示例中解决这个问题,但无法理解它! 我有一个 curl 命令,我可以从 Windows 命令行成功运行该命令,该命令行在 Solr 中索引 p
curl -v有什么区别和 curl -I ? 我可以看到 -v是冗长的和 -I是标题。有什么具体的吗? 最佳答案 -I (大写字母 i)在 curl 中表示“没有正文”,对于 HTTP 表示发送 H
我正在使用curl php API访问FTP链接。在特定站点上,它给出错误代码9(拒绝访问)。但是,可以从IE和Firefox访问该链接。 然后,我运行curl命令行,它给出了相同的“访问拒绝”结果。
我已经使用curl有一段时间了,它可以正常工作,但是使用使用用户'domain\username'来验证curl的代理时,无法请求授权。授权方法是NTLM。此代码放入批处理文件中。 代码: curl
“curl”默认使用哪些证书? 例子: curl -I -L https://cruises.webjet.com.au 在 Ubuntu 15.04 上失败 curl: (60) SSL certi
我知道终端输出的一部分是请求的持续时间,剩余时间等。但是是否有一些文档指定了curl命令的终端输出的每一列到底是什么?手册页上的内容非常稀疏。 最佳答案 可能不容易找到,但已在the curl boo
我想通过 curl 在我自己的云服务器上的特定文件夹中上传文件。例如:http://www.myowncloudserver.com/remote.php/webdav/{MY_FOLDER}。此时我
我的网站上有一个密码保护的Web文件夹,我正在使用Curl在另一个域上获取该文件夹,我想要的是:当我尝试打开URL时,应该问我用户名和密码,而不是让它显示“需要授权”。 例: http://www.e
有没有一种方法可以通过简单的Curl获取Rabbitmq中队列的大小(剩余消息)? 类似于curl -xget http://host:1234/api/queue/test/stats 谢谢 最佳答
关闭。这个问题是opinion-based .它目前不接受答案。 2年前关闭。 锁定。这个问题及其答案是locked因为这个问题是题外话,但具有历史意义。它目前不接受新的答案或互动。 我最近开始在我的
我想访问需要用户名/密码的 URL。我想尝试用curl 访问它。现在我正在做类似的事情: curl http://api.somesite.com/test/blah?something=123 我收
我正在尝试使用 CURL 进行查询ElasticSearch 中的命令在windows平台。 例如:localhost:9200/playground/equipment/1?pretty 我收到一条
我正在尝试使用 Docker 构建和运行 Marklogic 实例。 Marklogic 提供了一些不错的 http api,所以,作为最终 CMD在 Dockerfile 中,我运行两个脚本,它们通
我正在尝试通过 cURL 检索网页的内容(比方说 http://www.foo.com/bar.php )。 当我在浏览器中加载网站时,加载页面时会出现动画,页面最终会显示出来。 但是使用 cURL,
我正在尝试使用带代理的命令行 CURL 获取响应状态代码。 这会返回整个页面,但我只想要状态代码。我怎么做?谢谢。 curl -sL -w -x IP:PORT "%{http_code}\n""ht
我有一段代码检查 http/s 端点的状态和加载时间。然后我会为每个顶级页面检查 1 级 href,以检查页面引用的所有内容是否也加载了 200。 (我查了50个顶级页面,每个顶级页面平均有8个链接)
curl --upload-file 和 curl --form file=@/path/file 有什么区别?这些 HTTP 请求有何不同? 最佳答案 --上传文件 (使用 HTTP 或 HTTPS
我正在尝试使用 system-curl 安装 cmake,使用 ./bootstrap --system-curl,如 here 所示.这样做,我得到了: -- Could NOT find
我需要使用 Curl 下载 Youtube 视频的特定部分。 (假设我想下载前 2MB)我在 Curl 中使用 -r 开关来实现这一点。它适用于非 YouTube 链接,但 Youtube 链接会忽略
我希望在使用 curl 命令从远程服务器下载文件后,将时间戳或日期添加到文件名中。我知道您可以使用 -o 来指定您要为文件命名的内容。我看到过这样的建议:-o "somefile $(date +\"
我是一名优秀的程序员,十分优秀!