0

we want to create a script that gather data from url.

I have read a lot about this in internet, but cant manage to make it work.

The data i need to get is a key that is found on a specific url.

playlist: '/get_file.php?stream=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=',

i need that long key that is after **stream=** and ends with

',

we saw some examples, like:

<?php
  $link = file_get_contents("http://www.domain.com");
  $file = strip_tags($link, "<div>");
  preg_match_all("/<div/>(?:[^<]*)<\/div>/is", $file, $content);
  print_r($content); 
?>

but its not our case. Please help us to get this data from url, thnx for reading.

4
  • how are you getting the url? Commented Nov 20, 2013 at 16:08
  • I'm inclined not to answer, because it looks like you're attempting to subvert a website's content protection measures. Can you explain why you're doing this, and what you've tried so far? Commented Nov 20, 2013 at 16:10
  • hello,we have tried $link = ile_get_contents("domain.com"); Commented Nov 20, 2013 at 16:11
  • @squeamishossifrage, we have tryed some examples but with nor results. please can you help us to get the code after stream= ? pls Commented Nov 20, 2013 at 16:12

2 Answers 2

1
$url = 'www.example.com';
$url .='/get_file.php?stream=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=';
$queryArray =  parse_url($url);

the stream argument will be contained within

$queryArray['query'];

This will be an array if there is more than one argument

var_dump($queryArray);

To see all its options

See here php parse_url

Working Example

<?php
$url = 'www.example.com';
$url .='/get_file.php?stream=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=';
$queryArray =  parse_url($url);
echo $queryArray['query']."<br>"."<br>"."<br>";
var_dump($queryArray);
?>

will return

stream=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=


array(2) { ["path"]=> string(28) "www.example.com/get_file.php" ["query"]=> string(155) "stream=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=" }
Sign up to request clarification or add additional context in comments.

6 Comments

hello, the stream= is inside the html file not in url. thnx.
if you are grabbing just the stream part then add a fake url to the start then parse it
also it can be found inside a A href tag, like this one. <a href="/get_file.php?id=8A945E5D3E4EC17A&key=WyJPRUU1TkRWRk5VUXpSVFJGUXpFM1FUb3hNemcxTWpFME5Ua3lMamMzTlRRNlpHWTBZV00wTUdVNU16ZzJObVZqTkdFNU9HSXdaVEptT0dGaE5XUmhaREUzTUdVd09UUTJaZz09IiwicmVnIl0=&original=1" class="download_file_link" target="_blank" style="margin:0px 0px;">Download File</a>
we dont know the key after stream=, also it is found inside the html file..i get nothing with your example, what is wrong ?
the problem is that i need that key.. that is changed on every url. please read my question, that key is inside a html.. i have used your example but dont return what i am looking for.
|
1

You could try preg_match:

$found = preg_match("/stream=(.+)'/", $html, $match);
if ( $found ) {
    echo $match[1]; 
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.