Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Check if URL exists

I want to check if URL exits and all the examples that I found in the internet (file_exists, fsockopen, ..) and none of them worked.
0
VapiSoft
Asked:
VapiSoft
  • 3
  • 3
1 Solution
 
Om PrakashCommented:
Please check the following which uses curl_exec:
http://www.weberdev.com/get_example-4335.html

using header:
http://us3.php.net/manual/en/function.header.php
0
 
hernst42Commented:
Or youcan use the stream extension. See http://www.php.net/manual/en/function.stream-get-meta-data.php
0
 
VapiSoftAuthor Commented:
I tried it, but I don't have the "curl_init(); " and all the other "cur..."
How do I get them?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
VapiSoftAuthor Commented:
to hernst42: I tried
$url="http://isragerb.narod.ru/bakajat.gif";
 if (stream_get_meta_data($url))
but I get the the parameter is invalid.
0
 
Om PrakashCommented:
>>I tried it, but I don't have the "curl_init(); " and all the other "cur..." How do I get them?
You can enable this in php.ini file (for windows).
extension = php_curl.dll

in linux
extension = php_curl.so


0
 
VapiSoftAuthor Commented:
Hi om_prakash_p:

It works (and I will give you the points) but maybe you know what is the problem.
I get the following warrning:

Warning: curl_exec() [function.curl-exec]: Could not call the CURLOPT_HEADERFUNCTION in C:\wamp\www\MyTree\test1.php on line 53
0
 
Om PrakashCommented:
this might be due to echo or print statements written before sending the request. try commenting the echo statements.

more examples:
http://php.net/manual/en/function.curl-exec.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?> 

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now