想要使用php从.jsp页面的结果中检索特定数据

时间:2016-03-12 16:40:35

标签: php xml jsp

这是我在这里的第一个问题 我有以下代码:

<?php
set_time_limit(3000);
$url= "https://telenorcsms.com.pk:27677/corporate_sms2/api/auth.jsp?   msisdn=xxxx&password=xxxx";
print_r(get_data($url));

function get_data($url)
{
 $ch = curl_init();
 $timeout = 5;
 curl_setopt($ch,CURLOPT_URL,$url);
 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
 $data = curl_exec($ch);
 curl_close($ch);
 return $data;
}
?>

但不幸的是,它没有给出任何回应。只是一个空白页面。

我希望以XML格式获取响应并仅查找<data>值 在浏览器中直接访问URL时,会给出以下响应:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<corpsms>
  <command>Auth_request</command>
  <data>e8570f2482444d0ca50b76727d01a846</data>
  <response>OK</response>
</corpsms>

请回答一些解决方案......

0 个答案:

没有答案