cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE : curl link tester

From: Stéphane Viaud-Murat <sviaud_at_madwaves.com>
Date: Mon, 19 Jan 2004 16:17:25 +0100

Steve,

Do you mean you receive a 0 error code ?
It is supposed to be a CURL OK code...

Stephane

-----Message d'origine-----
De : curl-and-php-admin_at_lists.sourceforge.net
[mailto:curl-and-php-admin_at_lists.sourceforge.net] De la part de Steve
Miller
Envoyé : lundi 19 janvier 2004 15:58
À : curl-and-php_at_lists.sourceforge.net
Objet : curl link tester

Hi.

First of all, I will admit to being a curl infant, and I could use some
guidance and help! I am trying to use curl within a php script to simply
test urls and tell me if they are good or not. This is what I have put
together:

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$urla[0]);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch,
CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch,CURLOPT_NOBODY,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);// return into a variable
$curl_result=curl_exec($ch); $httpcode=curl_getinfo($ch,
CURLINFO_HTTP_CODE); curl_close($ch);

I then look at the value of $httpcode and make decisions.

The problem I am having is that if the url is to anything that requires
a browser plugin (like pdf, jsp...) this script returns a "zero" code
even when the link is known to be good. Can anyone wlak me through the
proper way to do what I am trying to do?

Many Thanks,
steve

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the
breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-19