LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   curl won't connect my website... (https://www.linuxquestions.org/questions/programming-9/curl-wont-connect-my-website-948691/)

masavini 06-05-2012 05:16 PM

curl won't connect my website...
 
hi,
sorry for this question, i'm pretty sure it sounds quite stupid...
but i really can't find how to solve it...
i have a script that checks if a directory exists on my web site. if it doesn't it creates it with lftp.

the problem is that the command
Code:

curl --head "http://www.mywebsite.com/tmp/"
doesn't work anymore. it worked fine until yesterday and it still works on other computers in my office, but it doesn't work on the server.
i tried and reinstall curl, but nothing happens.

the weird thing is i can download any other webpage (i.e. http://www.google.com) but i can't get my web site (that is online, obviously).

thanks for your help....

dugan 06-05-2012 05:56 PM

Posting the console output would help.

masavini 06-05-2012 06:16 PM

i didn't post it because i didn't want to advertise my website... and the issue was only with that site!
anyway, i solved just rebooting the host of the virtual server... now curl works a charm like before...
very strange, i'll post if it happens again.

thank you, anyway...

masavini 06-11-2012 08:57 AM

ok, here is what i got after MANY debug attempts...

on my site there is a livechat service.
on my laptop i have a script with some wget commands that make me visible by website visitors and alert me if a chat is requested.
most of wget commands are executed when the script is launched... chat alert is based on a sigle wget command executed every 30 secs.

on my server (which is under the same public ip) i have many scripts that occasionally connect to my website and upload/download some pages.

what happens is VERY strange:
when the laptop script signs me into the live chat service everything works fine on the laptop, but my website can't be reached on the server.
wget, lynx and even firefox won't find it... i.e.:
Code:

teo@server:/tmp$ lynx -dump www.li-tech-shop.it
Looking up  'www.li-tech-shop.it' first

Looking up www.li-tech-shop.it
Making HTTP connection to www.li-tech-shop.it
Alert!: Unable to connect to remote host.

lynx: Can't access startfile http://www.li-tech-shop.it/
teo@server:/tmp$

if i sign off from livechat, after a few minutes everything returns ok on server, as well.

this is the login function:
Code:

# log in livehelp
function log_in() {
    wget -q -O - --keep-session-cookies --save-cookies=$cookie_file --post-data='proccess=yes&myusername='${username}'&mypassword='${passwd}'&matchip=Y&adminsession=Y' "$baseURL/login.php" > $redirect_file
   
    redirect=$(grep "cslhOPERATOR" $redirect_file | awk -F '"' '{print $2}')

    wget -q -O - --load-cookies=$cookie_file --keep-session-cookies "$baseURL/$redirect" > /dev/null # $__tempDir/check.html
    wget -q -O - --load-cookies=$cookie_file --keep-session-cookies --post-data='status=Y' "$baseURL/admin_rooms.php" > /dev/null # $__tempDir/check.html
       
    wget -q -O - --load-cookies=$cookie_file --keep-session-cookies --post-data='department='"$department"'&username='"$username" "$baseURL/admin_users_refresh.php" > $users_file
}

can you help me and debug this issue? i really can't figure out what could cause it...

masavini 06-11-2012 10:20 AM

anothe piece of the puzzle:
while wget, lynx and ff fail to connect on server, ping works fine:
Code:

teo@server:/tmp$ ping "www.li-tech-shop.it"
PING www.li-tech-shop.it (62.149.140.134) 56(84) bytes of data.
64 bytes from webx124.aruba.it (62.149.140.134): icmp_req=1 ttl=63 time=33.1 ms
64 bytes from webx124.aruba.it (62.149.140.134): icmp_req=2 ttl=63 time=32.6 ms
64 bytes from webx124.aruba.it (62.149.140.134): icmp_req=3 ttl=63 time=33.1 ms
^C
--- www.li-tech-shop.it ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 32.693/32.999/33.168/0.216 ms
teo@server:/tmp$ wget http://www.li-tech-shop.it
--2012-06-11 17:13:45--  http://www.li-tech-shop.it/
Resolving www.li-tech-shop.it... 62.149.140.134
Connecting to www.li-tech-shop.it|62.149.140.134|:80... failed: Connection timed out.
Retrying.

--2012-06-11 17:14:07--  (try: 2)  http://www.li-tech-shop.it/
Connecting to www.li-tech-shop.it|62.149.140.134|:80... ^C



All times are GMT -5. The time now is 12:46 PM.