php


Retrieve table data from another webpage using PHP


I want to retrieve some data that in a table format form that webpage i need in my webpage.
I follow many link and solution from stackoverflow but i can't get any data.
Below are the URL that data i want to retrieve:
http://www.ip2location.com/demo/1.22.99.222
In the above URL one information table that data i want get.
Please anyone provide the code for retrieve data.
Thank you in advance.
Here are the code. I can't get any error from this code. Also can't get output of regex filter code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To MY Page</title>
</head>
<body>
<div class="signform">
<?php
// Function to get the client ip address
echo "<br/>".$_SERVER['REMOTE_ADDR'];
echo "<br/>".$_SERVER['SERVER_NAME'];
echo "<br/>".$_SERVER['SERVER_SOFTWARE'];
echo "<br/>".$_SERVER['SERVER_PROTOCOL'];
echo "<br/>".$_SERVER['ALL_HTTP'];
echo "<br/>".$_SERVER['HTTP_USER_AGENT']."<br/>";
// These lines are mandatory.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
echo "Device Type : Mobile";
}
// Any tablet device.
else if( $detect->isTablet() ){
echo "Device Type : Tablet";
}
else {
echo "Device Type : PC";
}
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
$content = file_get_contents("http://www.ip2location.com/demo/$ip");
preg_match_all('/<body>(.*?)<\/body>/s',$content,$output,PREG_SET_ORDER);
echo $output;
echo "<br/> ISP : ".$isp."<br/> City : ".$city."<br/> State : ".$state."<br/> Country : ".$country."<br/> zipcode : ".$zipcode;
?>
</div>
</body>
</html>
Here are the Screenshot of Output:
1.22.98.173
appstechsolution.in
Apache Phusion_Passenger/4.0.10 mod_bwlimited/1.4 mod_fcgid/2.3.9
HTTP/1.1
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
Device Type : PC1.22.98.173Array
ISP :
City :
State :
Country :
zipcode :
Use simpleHTMLDom this will load destination web page and scrap needed table.
include_once('classes/simple_html_dom.php');
$html = file_get_html('http://www.ip2location.com/demo/1.22.99.222');
echo $html->find("#main-content .table", 0);

Related Links

Working Of Paypal Rest API
How make my menu active class
regular expression basics - [^.] [duplicate]
PHP JSON array from query
REST API in Laravel when validating the request
Pass $.variable in url
PHP Multilanguage site
Not able to access nested Object elements
Wordpress: Adding an extra folder name in the url before all posts
nth-child dont work when i add a href
When my controller function loads a view, the URL has the controller name and function still in the URL. How can I get rid of this?
PHP clarifation of file_exists function, does it check for the actual file or just a path
How do I get what option the user selected?
PDO Access Database - Illegal characters when inserting rows
Why won't my first sql statement run
No privileges on phpMyAdmin

Categories

HOME
php
yaml
loopbackjs
dafny
iverilog
nsis
fogbugz
navigation
joomla3.2
graphdb
tiff
rangy
xbap
powermock
bundler
nest-api
checkout
jaspersoft-studio
android-custom-view
workday
pst
stackexchange.redis
pymongo
cell
nurbs
cellular-network
uilocalnotification
python-imageio
gravity-forms-plugin
php-5.3
tsung
ibm-connections
fusion
unmarshalling
amazon-iam
substance
copy-protection
d3.js-v4
netbios
grails-2.5
numerics
ng-repeat
django-smart-selects
rdp
grails-spring-security
1wire
contactless-smartcard
google-prediction
fluid-mac-app-engine
git-tfs
sendinput
flume-twitter
section508
icecast
nusoap
head.js
entropy
pen
nivo-slider
alertify
adobe-reader
openerp-6
d3v4
gapi
xcode8-beta4
deferred-rendering
highlighting
exists
xcopy
jsr363
android-expansion-files
opencyc
cfwheels
search-form
alwayson
unidata
scala-macros
debug-symbols
fasterxml
rebar
webmethod
csslint
wso2bam
principalcontext
sensormanager
acitree
indesign-server
jquery-cycle
proc-open
system-requirements
image-scanner
liveconnect
dynamic-c
drawimage
net-use
firefly-mv
startupscript
directshow.net
servlet-container
dip
fgetc
data-retrieval
gtktextview
bindable-linq

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App