homepage Welcome to WebmasterWorld Guest from 54.211.164.132
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
getting response code using wget
getting response code using wget
kirang




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

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




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved