Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我是否可以使用phpQuery从一个PHP脚本发布到另一个脚本,或者如果可能,只使用普通PHP?_Php_Post_Web Crawler_Phpquery - Fatal编程技术网

我是否可以使用phpQuery从一个PHP脚本发布到另一个脚本,或者如果可能,只使用普通PHP?

我是否可以使用phpQuery从一个PHP脚本发布到另一个脚本,或者如果可能,只使用普通PHP?,php,post,web-crawler,phpquery,Php,Post,Web Crawler,Phpquery,可以将变量从一个PHP脚本发布到另一个PHP脚本的例子不胜枚举 我希望第一个脚本发布到第二个脚本,但要保持第一个脚本仍在运行。这些文件是crawler.php和links.php。怎么做?使用cURL <?php // crawler.php $url = 'localhost/links.php'; // Change me to what ever $fields = array('foo' => 'bar'); //url-ify the data for the POST

可以将变量从一个PHP脚本发布到另一个PHP脚本的例子不胜枚举

我希望第一个脚本发布到第二个脚本,但要保持第一个脚本仍在运行。这些文件是crawler.php和links.php。怎么做?

使用cURL

<?php 
// crawler.php
$url = 'localhost/links.php'; // Change me to what ever
$fields = array('foo' => 'bar');

//url-ify the data for the POST
$fields_string = '';
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

这是我第一次看到《每日邮报》的记者写关于堆栈溢出的问题。对不起!我有点恼火,上次我问了一个问题,有20个人评论说这太难了,或者你不能(你可以),或者他们需要的信息比人类所能提供的更多。你能详细描述一下你想做什么,特别是你所说的“帖子”是什么意思吗(即,第二个http请求,通过套接字等)@tandu我在谷歌搜索中看到了一个解决方案,但对我来说毫无意义。
要保持第一个脚本仍在运行
并发php编程?)这是否需要将某些内容发送回原始脚本?(编辑)我只是不希望第一个脚本在发送请求后停止运行,我看到的示例就是这样做的。卷曲会起作用的,我想:)