![]() |
PHP gurus - Need your help
I'm trying to code a robot and some how the remote servers finds out it's not a real user and redirect my robot. So I made three files to catch the diff in the header I'm sending.
the first one is a server scirpt which displays $_SERVER values. Code:
<? Code:
<body> Code:
HTTP_HOST = myfhg.com |
The last script is a bot script that's supposed to simulate the same post as the second script :
Code:
$sock = fsockopen($URL, 80, $errno, $errstr); Code:
HTTP_HOST = www.myfhg.com WHY ARE THE RESPONSE DIFFERENT ? How does the remote server spot my robot ? and how can I fix this ? |
Try to sniff IE's request headers on that url and use the same request as IE
|
You're using no subdomain on the first attempt and www.domain.com on the bot attempt. Other then that, and the fact you are missing a couple of headers on your bot post, You successfully posted as Mozilla so it's working fine.
|
Quote:
|
let us know how that works out
|
my guess is that the response from the server tries to create cookies when I use my bot. My guess is that my server refuses to create those cookies.
How can I test if the my server accept those cookies ? or work around this problem ? (maybe by simulating interaction with cookies ?) |
If you use CURL you can accept cookies, however I've run in to the same problem with my robot/spider ( trying to spider FEMJOY hosted galleries ) even when using CURL so good luck.. you'll probably need it unfortunately.
http://us3.php.net/manual/en/ref.curl.php#75525 - there's a little function that will help if it is indeed cookies that are the issue. Please post back here if you happen to figure it out! |
Just break down and use cURL, like you should be. Set a cookie file, init it, and forget all of your problems with your happy cURL wrapper.
|
like GrouchyAdmin said, don't use fsockopen, curl will work 20x better...
|
All times are GMT -7. The time now is 06:11 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc