Welcome to WebmasterWorld Guest from 54.227.83.19

Forum Moderators: bakedjake

Message Too Old, No Replies

getting response code using wget

getting response code using wget

     

kirang

3:10 pm on Apr 17, 2008 (gmt 0)

5+ Year Member



Hi All,

I need the http response code of the url.
What i am trying is :

wget -t1 -T30 -d --user-agent="Mozilla/4.0 (compatible; MSIE 4.0)" -q -O - [yahoo.com...]

And it show me the o/p as :

Setting --user-agent (useragent) to Mozilla/4.0 (compatible; MSIE 4.0)
Setting --quiet (quiet) to 1
Setting --output-document (outputdocument) to -
DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

Caching www.yahoo.com => 209.191.93.52
Created socket 3.
Releasing 0x000000000063b3e0 (new refcount 1).

---request begin---
GET / HTTP/1.0
User-Agent: Mozilla/4.0 (compatible; MSIE 4.0)
Accept: */*
Host: www.yahoo.com
Connection: Keep-Alive

---request end---

---response begin---
HTTP/1.1 200 OK
Date: Thu, 17 Apr 2008 15:06:24 GMT
Set-Cookie: B=ccieonh40eprg&b=3&s=04; expires=Tue, 02-Jun-2037 20:00:00 GMT; path=/; domain=.yahoo.com
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Cache-Control: private
Vary: User-Agent
X-XRDS-Location: [open.login.yahooapis.com...]
Last-Modified: Thu, 17 Apr 2008 14:43:49 GMT
Accept-Ranges: bytes
Content-Length: 9490
Connection: close
Content-Type: text/html; charset=utf-8

---response end---

I m using php script for running this command.
But the return content from the script is only the page source. All the --d (DEBUG) information is not stored. i.e. the part which starts with "---response begin---" didnt come in the script, however on shell it does o/p.
Any idea that how to capture the response-begin part thru php script.

physics

4:42 pm on Apr 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try adding 2>&1 to the end of your wget command. This will redirect standard error to standard out, which might get you the response info you're looking for.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month