[英]Unable to collect values from array URL in PHP
3rd party passes the details to the URL. 第三方将详细信息传递给URL。 It makes get request to the URL with details as url-encoded HTTP query parameters.
它以URL编码的HTTP查询参数的形式向URL发出获取请求。
following is the URL sample : http://_______.com/customer_missed_call.php?CallSid=e9536ef16460727558c0db17349021b0&From=09513325525&To=08039511763&Direction=incoming&DialCallDuration=0&StartTime=2016-02-10+14%3A56%3A17&EndTime=0000-00-00+00%3A00%3A00&CallType=callattempt&DialWhomNumber=&Created=Wed%2C+10+Feb+2016+14%3A56%3A17&flow_id=67475&tenant_id=24683&CallFrom=09513325525&CallTo=8039511763&ForwardedFrom=&CurrentTime=2016-02-10+14%3A56%3A17 以下是URL示例: http : //_______.com/customer_missed_call.php?CallSid=e9536ef16460727558c0db17349021b0&From=09513325525&To=08039511763&Direction=incoming&DialCallDuration=0&StartTime=2016-02-10+14%3A56%3A17&EndTime=0000-00 3A00%3A00&CallType = callattempt&DialWhomNumber =&Created = Wed%2C + 10 + Feb + 2016 + 14%3A56%3A17&flow_id = 67475&tenant_id = 24683&CallFrom = 09513325525&CallTo = 8039511763&ForwardedFrom =&CurrentTime = 2016-02-10 + 14%3A56
I want to collect the values of 'CallSid' and 'From' from this url. 我想从此网址收集“ CallSid”和“发件人”的值。
I tried following codes 我尝试了以下代码
<?php echo $_GET; ?>
and 和
<?php echo utf8_decode(urldecode($_GET)); ?>
and 和
$URL = $_SERVER['REQUEST_URI'];
$parsedURL=parse_url($URL);
$URLQ=$parsedURL['CallSid'];
echo $parsedURL;
but did not got values for any one of the above code. 但没有获得以上任何代码的值。 Please try to give effective solution for the above problem.
请尝试为上述问题提供有效的解决方案。 Thanks in advance.
提前致谢。
The "?"-delimiter is missing in the URL URL中缺少“?”分隔符
Edit: Please provide how you call the URL (the code for the request). 编辑:请提供您如何调用URL(请求的代码)。
$_GET['CallSid'];
should do the trick normally 应该正常地解决问题
They are missing an ?
他们错过了
?
after the .php
.php
It should be like this: 应该是这样的:
http://_______.com/customer_missed_call.php?CallSid=e9536ef16460727558c0db17349021b0&From=09513325525&To=08039511763&Direction=incoming&DialCallDuration=0&StartTime=2016-02-10+14%3A56%3A17&EndTime=0000-00-00+00%3A00%3A00&CallType=callattempt&DialWhomNumber=&Created=Wed%2C+10+Feb+2016+14%3A56%3A17&flow_id=67475&tenant_id=24683&CallFrom=09513325525&CallTo=8039511763&ForwardedFrom=&CurrentTime=2016-02-10+14%3A56%3A17
One of the things that is likely causing an issue is that parse_url returns an array with predefined keys. 可能引起问题的原因之一是parse_url返回带有预定义键的数组。 The key for the query is 'query' (
$parsedURL['query'];
) 查询的键是'query'(
$parsedURL['query'];
)
However using the $_GET method is much more easy to read and is easier than getting the query string and manually parsing it. 但是,使用$ _GET方法比获取和手动解析查询字符串要容易得多,并且容易得多。 To access values in it, you also need to specify a key, not just call the array itself.
要访问其中的值,还需要指定一个键,而不仅仅是调用数组本身。 eg:
例如:
$callSID = $_GET['CallSid'];
$from = $_GET['From'];
Hope that helps 希望能有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.