Jump to content

Get specific data from another website


ExSpirit

Recommended Posts

Sure, it's possible. Could be done in a number of ways, the easiest (for me) is cURL. You could however also use DOMDocument.

 

Then you'd have to do a regex on the page source and get the values you need. I'd give you an example on the site you just gave, but when I'm loading it, I get the following error:

 

You may have mis-typed the URL. Please check your spelling.

Link to comment
Share on other sites

cURL is pretty simple though, basic examples are here:

http://curl.haxx.se/libcurl/php/examples/simpleget.html

 

Rough draft, didn't test it:

 

<?php
$CurlStart = curl_init();
curl_setopt ($CurlStart, CURLOPT_URL, "http://www.gamersfirst.com/warrock/?q=Player&nickname=soldier");
curl_setopt ($CurlStart, CURLOPT_HEADER, 0);
$source = curl_exec ($CurlStart);
curl_close ($CurlStart);

$a=preg_match("/Level:</td>\n.*.<td>([0-9]+)</",$source,$b);
$Level = $b[2];
?>

Link to comment
Share on other sites

I tried this code and I get this error:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
...

Warning: preg_match() [function.preg-match]: Unknown modifier 't' in /home/content/test.php on line 8

Link to comment
Share on other sites

The bottom error is gone, but the internal Server Error is still there... I have no idea why...

 

Internal Server Error

 

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

Apache/2.2.11 (Ubuntu) Server at www.gamersfirst.com Port 80

Link to comment
Share on other sites

<?php
$CurlStart = curl_init();
curl_setopt ($CurlStart, CURLOPT_URL, "http://www.gamersfirst.com/warrock/?q=Player&nickname=soldier");
curl_setopt ($CurlStart, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($CurlStart, CURLOPT_REFERER, $url);
curl_setopt ($CurlStart, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; nl; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11");
curl_setopt ($CurlStart, CURLOPT_HEADER, 1);
curl_setopt ($CurlStart, CURLOPT_FOLLOWLOCATION, true);
$source = curl_exec ($CurlStart);
curl_close ($CurlStart);

$a=preg_match("/>Level:.*.\n.*.>([0-9]*)</",$source,$b);
$Level = $b[1];
echo "Level: $Level";
?>

Link to comment
Share on other sites

I managed to get most of the data, but now I'm a bit stuck at a few values:

 

Clan Name (uses href)

Clan Tag

Recruitment (uses span)

 

Beside that if Clan name or tag is empty then the code shows me input box - probably because there's another "Clan tag" and "Clan name:" in code which has input field after...

 

To get better view of the code you should check THIS LINK, where all fields are checked.

 

Can you help me how to get those values?

Link to comment
Share on other sites

  • 2 weeks later...

Hi.

Beside getting the data from other websites you can change the name or tag is empty then the code shows me input box. I agree to this term..

 

 

 

 

_______________________________________________________________________

Earn an Extra $1000 to $1200 per month doing Part Time Data Entry Jobs! Work from home data entry jobs to post simple data submissions on Internet. Make $1 per entry. Easy form filling, data entry and ad posting jobs. No selling, No phone calls, No Marketing. No Investment. Bi-weekly payments. Full Training Provided. Pls visit: Data-Entry

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.