samedi 2 juillet 2016

PHP parse query data from html

I need some help with my code. I want to parse the data from the streams tags but I cant find out how I could do this.

When I try this:

$streams_url = $xpath->query("//span[@id='streams'"]);

I will get something like this:

serverip page isn’t working

serverip is currently unable to handle this request.

HTTP ERROR 500

Here is the php:

<?php
ini_set('max_execution_time', 300);
error_reporting(0);
$errmsg_arr = array();
$errflag = false;

function getState($string)
{
  $ex = explode(" ",$string);
  return $ex[1];
}

$baseUrl = file_get_contents('http://myserverip/get-listing.php');

$domdoc = new DOMDocument();
$domdoc->strictErrorChecking = false;
$domdoc->recover=true;
@$domdoc->loadHTML($baseUrl);
$links = $domdoc->getElementsByTagName('a');
$i = 0;
$count = 0;
$streams_url = $xpath->query("//span[@id='streams'"]);

echo $streams;

$data = array();
foreach($links as $link)
{
  if($link->getAttribute('href'))
  {
  }
}
>?

Here is the html data:

<a id="link1" href="http://myserverip/getlisting.php?channel=skyatlantic">http://myserverip/getlisting.php?channel=Sky Atlantic&id=108</a><br><br><a id="streams" href="rtmp://www.testserver.com/skyatlantic">Stream 1</a>

Here is what I want to achieve:

rtmp://www.testserver.com/skyatlantic

I want to parse each url from the streams tags.

Can you please show me how i could do this in PHP??

Aucun commentaire:

Enregistrer un commentaire