简体   繁体   English

PHP和卷曲-等待什么?

[英]php and curl - waiting for what?

A quicky - three .php pages with some form data passed from page0->page1->page2. 一个快速的-.php页面,共有三个页面,其中一些数据是从page0-> page1-> page2传递的。 When 'submit' gets clicked on page0 it goes to page1, etc. No big deal. 当单击“提交”在page0上时,它会转到page1,依此类推。没什么大不了的。

Im trying to use curl to do the page transfer after the form data is stored. 我试图在存储表单数据后使用curl进行页面传输。 This shouldn't be a big deal.. right? 这不应该是大问题..对吗?

Each page is short, simple HTML. 每个页面都是简短的HTML。 Nothing special. 没什么特别的。 They should load in a heartbeat. 他们应该心跳加速。 And they do from my local apache server. 它们是从我的本地apache服务器执行的。 When I put them on our dept server (also running apache) the first page loads and then.. nothing.. I can load them all separately but I can't seem to link between them. 当我将它们放在我们的部门服务器(也正在运行apache)上时,将首先加载页面,然后..什么都没有。我可以分别加载它们,但似乎无法在它们之间链接。 After a few minutes the page times out. 几分钟后,页面超时。 No error messages. 没有错误讯息。

I checked the .php build on the server and curl is definitely installed. 我检查了服务器上的.php版本,并确定安装了curl。

What am I missing? 我想念什么? Its got to be something obvious. 它必须是显而易见的。

$ch=curl_init();
curl_setopt( $ch, CURLOPT_URL,"http://server.org/php/forms/form1.php?lid=" . $lastId );
curl_exec( $ch );
curl_close( $ch );

Step 1: check that the server you're accessing is actually accessible from where the script is run and that DNS works properly. 步骤1:检查您正在访问的服务器是否可以从运行脚本的位置实际访问并且DNS正常运行。

Then again, I don't really understand what's the purpose of this. 再说一次,我真的不明白这是什么目的。 Why not just use include? 为什么不仅仅使用include? Or are all the pages on different servers? 还是所有页面都在不同的服务器上?

All pages are on the same server. 所有页面都在同一服务器上。 I want to have them appear sequentially when the form on each is submitted. 我想让它们在提交每个表单时顺序出现。 IE fill out form0, submit it, then go on to page 1, etc IE填写form0,提交,然后转到第1页,依此类推

Then you don't need any roundtrips with curl or anything else. 然后,您不需要进行任何带有卷曲的往返行程或其他任何活动。

Either use 无论使用

include 'form1.php'; // you will have the $lastId variable there

or 要么

header('Location: form1.php?lid='.$lastId);

Have you checked to see what the $ch is on the first page. 您是否检查过首页上的$ ch是什么。

Maybe you're closing an invalid handle. 也许您正在关闭无效的句柄。

Also, if you're looking to return the page data I believe you've missed some of the options. 另外,如果您想返回页面数据,我相信您已经错过了一些选择。

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

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