How to check url exits or not in PHP

How to check file exist in given URL – PHP.

FOr check url exist or not you have to use below function for it.

you can also check for xml path exits or not.

	$url = "";
		echo "URL is exists";
		echo "URL is not exists";

	function is_url_exist($url)
		$ch = curl_init($url);    
		curl_setopt($ch, CURLOPT_NOBODY, true);
		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		if($code == 200){
			$status = true;
			$status = false;
		return $status;

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s