Quantcast
Viewing all articles
Browse latest Browse all 10

Get content from another site with Curl and PHP

<?php
function get_string_between($string, $start, $end)
{
$string = ” “.$string;
$ini = strpos($string,$start);
if ($ini == 0)
return “”;
$ini += strlen($start);
$len = strpos($string,$end,$ini) – $ini;
return substr($string,$ini,$len);
}
//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Set the URL
curl_setopt($ch, CURLOPT_URL,”http://www.dsebd.org/”);
//Execute the fetch
$data = curl_exec($ch);

echo $da=get_string_between($data,’imgs/topdown.gif”>’,'imgs/topdown.gif’);
//Close the connection
curl_close($ch);

?>


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 10

Trending Articles