Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check if URL exists

Posted on 2010-08-30
7
Medium Priority
?
308 Views
Last Modified: 2013-12-13
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
Comment
Question by:VapiSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 22

Accepted Solution

by:
Om Prakash earned 2000 total points
ID: 33556322
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
 
LVL 48

Expert Comment

by:hernst42
ID: 33556334
Or youcan use the stream extension. See http://www.php.net/manual/en/function.stream-get-meta-data.php
0
 

Author Comment

by:VapiSoft
ID: 33556443
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.

 

Author Comment

by:VapiSoft
ID: 33556455
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
 
LVL 22

Expert Comment

by:Om Prakash
ID: 33556695
>>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
 

Author Comment

by:VapiSoft
ID: 33556790
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
 
LVL 22

Expert Comment

by:Om Prakash
ID: 33556944
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question