working fine on local pc but not on server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

novice4eva wrote:maybe it has to do with the COOKIE_FILE, but even if it were... then error should have popped out!! Did you check if the file is there or if it is writable, there is this verification done in one of the examples at http://www.php.net/curl

EDIT : there is also an example for checking errors in curl here http://www.php.net/manual/en/function.curl-errno.php
hi sir,
i thinks its due to cookie file. what i did today is i run script on my local computer and than upload cookie file generated by script to server. and try to grab grab page which require authentication and i was able to successfully grab that page.
i remove the request of login coz i have already uploaded cookie file.
is it so that login site server may be blocking the ip of my server to login??
sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

one more thing.
when i upload this script to windows based server.it working perfectly fine on it.
so whats the problem with linux server\?
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: working fine on local pc but not on server

Post by novice4eva »

It must have to do with the file permissions as i said earlier in my post, the file ie the cookie.txt must exist and if it does then it must be writable.
sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

novice4eva wrote:It must have to do with the file permissions as i said earlier in my post, the file ie the cookie.txt must exist and if it does then it must be writable.
yes,
i change permission to 777 for cookie.txt.
i came to know that there is something wrong with request made by server.
what i mean is when i run script on linux server, it is making using "GET" to make for login while on windows it is using "POST" .
SO I THINK I SHOULD CHANGE SOME PARAMETER OR DO SOMETHING SO SCRIPT ON SERVER WILL MAKE REQUEST IN "POST"
DO YOU KNOW HOW?
HERE IS MY HEADER FOR LINUX.

Code: Select all

* About to connect() to www28.discuss.com.hk port 80 (#0)
*   Trying 124.XXX.150.30... * connected
* Connected to http://www.discuss.com.  (124.244.150.30) port 80 (#0)
> GET /logging.php?action=login& HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Host: www28.discuss.com.hk
Accept: */*
Referer: http://www.discuss.com/logging.php?action=login
 
sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

i am using this two line also in my script for post.
curl_setopt ($ch, CURLOPT_POST, TRUE);
curl_setopt ($ch, CURLOPT_HTTPGET, FALSE);
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: working fine on local pc but not on server

Post by novice4eva »

Hummm, regardless of header what do you get if you do print_r($_POST) in the target page(if you have access to that page). I tried your code, and mine is linux server, and it worked well here :dubious:
sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

novice4eva wrote:Hummm, regardless of header what do you get if you do print_r($_POST) in the target page(if you have access to that page). I tried your code, and mine is linux server, and it worked well here :dubious:
sorry sir. i am not getting what you want to ask.can you elaborate it more so i can give you information on it. i want to access one page which require login first.but now i am getting login page again though making login before that page request.i dont have access to target page.
i think i am not able to login in successfully.
here is topic he is having same problem like me 100%.
viewtopic.php?f=1&t=89757&p=492636
i have inserted double quote and singel quote too but not working.
sunny12300
Forum Newbie
Posts: 14
Joined: Thu Jan 01, 2009 11:51 pm

Re: working fine on local pc but not on server

Post by sunny12300 »

waiting.anyone please.
Post Reply