curl-and-php
curl link tester
Date: Mon, 19 Jan 2004 09:57:43 -0500
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