开发者

Grab/Fetch content and giving specific text a variable using php

Using php coding, I'm attempting to make a script which will grab content from another URL and give each word/number a php variable. I'm unsure whether this is possible, hence the reason why I've come onto stackoverflow and hoping for assistance from other members.

This is what I've currently got:

<?php

$searchdata = file_get_contents('http://www.example.com/dynamic.html');
echo $searchdata;

?>

The code grabs the data from the page titled "dynamic.html" and displays it. The content within dynamic.html is simply a line of text, each word is separated by a single space. The contents within the page looks something similar to:

92 AULLAH1 325 6523 37 1 12 5 #endofscript

I've said it looks similar to,开发者_JS百科 as this is a dynamic page and varies all the time. The thing I'd like to do is give each number/word a php variable. E.G. 92, AULLAH1, 325, 6523, 37, 1, 12, 5 each should have a separate variable ($number, $text etc...). Notice I don't require a variable for #endofscript.

How would I go about doing this? The document is a dynamic page, so the numbers may be different as well as "AULLAH1".

Kind regards, and I appreciate every single response. :)


The number of data is fixed? Can you name them all?

list($number, $text, $othernumber, $phone, $age, 
     $smth, $andd, $last) = explode(" ", $searchdata);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜