- file_get_contents: documentation ( source)
- stream_context_create: documentation ( source)
- http_build_query: documentation ( source)
<?php
#header('Content-type:application/json;charset=utf-8');
$url = 'http://exotel.in/hacks/exotel-geo/iframe-index.php';
$data = array('mobile_number' => '7266788211');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
#var_dump($result);
# Create a DOM parser object
$dom = new DOMDocument();
@$dom->loadHTML($result);
#$output = array();
# Iterate over all the <a> tags
foreach($dom->getElementsByTagName('h2') as $link) {
# Show the <a href>
echo $link->nodeValue;
echo "<br />";
}
#var_dump($result);
?>