Jump to content

php socks to grab info


Ustag
 Share

Recommended Posts

Hello, im trying to use socks to grab only time and the "killed by" text from the character deaths from this page:http://www.tibia.com...ters&name=Apaci I use this code and ofc it gives me the whole page, now how can I filter what I get so that I only get the parts that I want?

$fp = fsockopen("www.tibia.com", 80, $errno, $errstr, 30);if (!$fp){	echo "$errstr ($errno)<br />\n";}else{$out = "GET /community/?subtopic=characters&name=Apaci HTTP/1.1\r\n";$out .= "Host: www.tibia.com\r\n";$out .= "Connection: Close\r\n";$out .= "Accept: text/plain\r\n\r\n"; fwrite($fp, $out);$lines = Array();while (!feof($fp)){	 $lines[] = fgets($fp, 1024);} for($i=0; $i<count($lines); $i++){	 echo $lines[$i];} fclose($fp); }

Edited by Ustag
Link to comment
Share on other sites

Do you have to use sockets? You could simply use DOMDocument's loadHTMLFile() method, or a plain fopen() call, combined with PCRE.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...