Forum Moderators: coopster
$API = the REST url
$xml = simplexml_load_file($API,'SimpleXMLElement',LIBXML_NOCDATA);
SimpleXMLElement Object ( [@attributes] => Array ( [stat] => ok ) [current] => SimpleXMLElement Object ( [region] => SimpleXMLElement Object ( [id] => usa [name] => United States ) [category] => SimpleXMLElement Object ( [id] => vehicle/powersports/atv [name] => ATVs [abbrev] => ATVs ) [start] => 1 [num] => 1 ) [listings] => SimpleXMLElement Object ( [element] => SimpleXMLElement Object ( [id] => 2113403615 [title] => 2007 Yamaha Rhino Atv 660 4x4 Sport [body] => The sport edition is the Rhino to have, it has a beautiful smoke silver hard coat finish, performance piggy back shocks, aluminium wheels, roof cover, special edition silver seats, sport steering wheels and special edition graphics. It has only 510 miles. Everything works like new and looks like new. The atv is listed nationally.The shipping is FREE within US. Please don't use "Respond" button because I can't check that email right now. If you want to buy it, to contact me please CLICK HERE Thank you! [url] => http://example.com/u_a2xx_/2113403615-P1u546,812-97FD41FAC27E/example.com___Azn_vnZgkb3pBte_XGZA_GoyfVEGcSl_WQxRT4W4Jetc-z2rp3NrYfAAMcibLlyptrCu5C5xOQU4kKrRk1RSDsIDRLlJK54EAauqmvfQtms, [category] => SimpleXMLElement Object ( [id] => vehicle/powersports/atv [name] => ATVs ) [source] => SimpleXMLElement Object ( [id] => www [name] => Oodle ) [location] => SimpleXMLElement Object ( ) [images] => SimpleXMLElement Object ( [element] => Array ( [0] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_0s?1282796183 [width] => 100 [height] => 75 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 0 [size] => s ) [1] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_0m?1282796183 [width] => 144 [height] => 108 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 0 [size] => m ) [2] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_0l?1282796183 [width] => 208 [height] => 156 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 0 [size] => l ) [3] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_0x?1282796183 [width] => 400 [height] => 300 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 0 [size] => x ) [4] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_1s?1282796184 [width] => 100 [height] => 75 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 1 [size] => s ) [5] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_1m?1282796184 [width] => 144 [height] => 108 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 1 [size] => m ) [6] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_1l?1282796184 [width] => 208 [height] => 156 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 1 [size] => l ) [7] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_1x?1282796183 [width] => 400 [height] => 300 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 1 [size] => x ) [8] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_2s?1282796184 [width] => 100 [height] => 75 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 2 [size] => s ) [9] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_2m?1282796184 [width] => 144 [height] => 108 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 2 [size] => m ) [10] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_2l?1282796184 [width] => 208 [height] => 156 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 2 [size] => l ) [11] => SimpleXMLElement Object ( [src] => http://example.com/item/2113403615u_2x?1282796184 [width] => 400 [height] => 300 [alt] => 2007 Yamaha Rhino Atv 660 4x4 [num] => 2 [size] => x ) ) ) [ctime] => 1282796183 [paid] => No [revenue_score] => 2 [user] => SimpleXMLElement Object ( [id] => 43618431 [url] => http://example.com/seller/43618431/ [name] => K M. [photo] => http://example.com/user/43618431_1282796543.jpg?nc=1 ) [similar_url] => http://example.com/2006_2008-yamaha/for-sale/atvs/price_2300_3100/mileage_0_20000/?inbs=1 [attributes] => SimpleXMLElement Object ( [condition] => Used [delivery] => Local Delivery [fee] => No [has_photo] => Thumbnail [make] => Yamaha [mileage] => 510 [price] => 2700 [price_display] => $2,700 [private_party] => Yes [seller_type] => Private Party [user_id] => 43618431 [year] => 2007 ) ) ) [meta] => SimpleXMLElement Object ( [total] => 22328 [returned] => 1 [first] => 1 [last] => 1 [search_time] => 0.00000 [search] => SimpleXMLElement Object ( [title] => ATVs For Sale [url] => http://example.com/used-vehicles/for-sale/atvs/ ) [post] => SimpleXMLElement Object ( [generic] => SimpleXMLElement Object ( [url] => http://example.com/post/? ) [category] => SimpleXMLElement Object ( [url] => http://example.com/post/?category=vehicle/powersports/atv ) ) [current_time] => 1282802244 ) )
$API = the REST url
$xml = simplexml_load_file($API,'SimpleXMLElement',LIBXML_NOCDATA);
print_r($xml);
exit;
<?php
// Create a curl handle
$ch = curl_init('http://www.example.com/');
// Execute
curl_exec($ch);
// Check if any error occured
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
}
// Close handle
curl_close($ch);
?>