【发布时间】:2015-05-07 12:08:03
【问题描述】:
所以我们有一个系统可以改变您在显示器上看到的内容。此代码旨在将作为“参数”的命令发送到该 JQuery 页面。
curl 运行良好,但是当我们注释掉处理重定向到 XML 文档的 if 语句时。发生重定向并且不执行 Curl 请求。我们需要了解为什么会发生这种情况,当我们删除重定向时,它会运行 curl 请求。当重定向到位时,不会执行 curl 请求。
请帮助找出导致此问题的原因和解决问题的方法,我们必须保留重定向,但如果有更好的方法来运行 curl 请求,即不使用 curl 但会很棒,任何建议都会被测试。
<html>
<head>
<?php
ob_implicit_flush(false);
$argument = $_GET["argument"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://example.com/sub/page.html?api_key=**********&device_id=************&argument=".$argument."");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
if($argument == 1) {
echo '<META http-equiv="refresh" content="0;URL=http://adloc8tor.com/ussd/service1.xml">';
} else if($argument == 2) {
echo '<META http-equiv="refresh" content="0;URL=http://adloc8tor.com/ussd/service2.xml">';
} else if($argument == 3) {
echo '<META http-equiv="refresh" content="0;URL=http://adloc8tor.com/ussd/service3.xml">';
} else if($argument == 4) {
echo '<META http-equiv="refresh" content="0;URL=http://adloc8tor.com/ussd/service4.xml">';
}
?>
</head>
</html>
【问题讨论】:
-
你的问题不清楚。