POST 请求中的 PHP Post 请求
有一个联系表单,当前操作是http://www.siteA.com/ContactInfo.php
,它发送字段和值。 在 ContactInfo.php 中,我只是捕获值并发送并通过电子邮件发送到 [email protected]< /a>
但是,在 ContactInfo.php 中,我需要将相同的数据发送到其他域中的另一个目的地 http://www.SiteB.com/Reg.aspx
我尝试创建向 SiteB 发出 http POST 请求,但即使在同一站点中使用另一个文件,它也不起作用。
我现在没有代码,但它与这个结构类似。
<? php
//ContactInfo.php
// CATCTH VALUES and SEND EMAIL
// CREATE Http POST REquest to another www.siteB.com/Reg.aspx
?>
我尝试过使用... HttpRequest 对象、cURL 和另一个...我不记得名字了。
There is a contact form which current action is http://www.siteA.com/ContactInfo.php
, it sends fields and values.
In ContactInfo.php, i just catch the values and send and email to [email protected]
BUT, inside ContactInfo.php, I need to send the same data to another destination, in other domain http://www.SiteB.com/Reg.aspx
I have tryed out to create an http POST request to SiteB, but It doesn't work, even with another file in the same site.
I have not the code right now, but it's similar to this structure.
<? php
//ContactInfo.php
// CATCTH VALUES and SEND EMAIL
// CREATE Http POST REquest to another www.siteB.com/Reg.aspx
?>
I have tryed out using... HttpRequest object, cURL, and the other one...i can't remember the name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 cURL 尝试类似的操作 (http://www.php.net /manual/en/curl.examples.php) ..
Shamly
You can try something like this using cURL (http://www.php.net/manual/en/curl.examples.php) ..
Shamly
我鼓励您尝试Snoopy 类。这真的很简单:
I'd encourage you to try the Snoopy Class. It's really rather simple:
如果没有看到您的代码,很难说出问题是什么。
问题:
站点 B 是您也拥有的域还是第三方的域?如果是第三方,他们可能会运行机器人检查等,这会使您的 POST 失败。
您是否已采取任何措施来确认数据确实发送到域 B?
如果域 B 也在您的控制之下,我的猜测是它们在同一个 Web 服务器上运行 - 为什么不直接将逻辑写入域 A 页面,该页面可以执行任何需要完成的操作,而不必提交到域 B?
Without seeing your code it's hard to say what the problem is.
Questions:
Is site B a domain you also own, or is it third party? If it's third party they may be running bot checks and the like that would make your POST fail.
Have you done anything to confirm that the data is in fact being send to domain B?
If domain B is also under your control, my guess is they are running on the same web server - why not just write logic into the domain A page that does whatever it is that needs to be done without having to submit to domain B?