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

curl-and-php

Re: RE : curl link tester

From: Steve Miller <steve_at_dinnys.com>
Date: Mon, 19 Jan 2004 10:46:19 -0500

Hi Stéphane.

I am checking the variable "$httpcode" to see what it returns. For example,
if it is equal to "404", I know I have a "file not found" situation.
However, for jsp and pdf files (so far), $httpcode is coming back equal to
zero.

If my whole approach is wrong or if there is a more correct way to do this,
I'll take any advice!

Thanks,
steve

> From: Stéphane Viaud-Murat <sviaud_at_madwaves.com>
> Reply-To: curl-and-php_at_lists.sourceforge.net
> Date: Mon, 19 Jan 2004 16:17:25 +0100
> To: <curl-and-php_at_lists.sourceforge.net>
> Subject: RE : curl link tester
>
> 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
Received on 2004-01-19