How to make PHP use an IP

Discussion in 'Site & Server Administration' started by redhits, Dec 6, 2006.

  1. #1
    I got around 50 IPs on a dedicated server, my problem is that i created lot's of PHP spiders (web-crawlers). Now I created an web hosting for all of them, and diferent IPs like:

    http://66.11.123.52/
    http://66.11.123.54/ ,etc,etc,etc


    My problem is this : My scripts are grabbing data from the web, but every time it does it's using the server default IP 66.11.122.226 , even if I cal the script from something like http://66.11.123.52/spider.php ....

    So how I can make it that if I call it from http://66.11.123.52/spider.php to run on IP 66.11.123.52/ !? not on 66.11.122.226 :(
     
    redhits, Dec 6, 2006 IP
  2. unispace

    unispace Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    A little more info about your script/configuration would help.

    What I assume you are doing is running spiders from the same server that has multiple IPs assigned to it. If this is the configuration, then problem lies in that the server has a dedicated IP so that every time it acts as a user it is recognized under this IP, the one configured for it.
    YOur other IPs just point to the server. If you login into your server and browse to a what page that tells you your IP, I would bet it would be one you don't want it to be.

    From my knowledge, to change this it depends on the server (i.e. Unix/Windows etc.).

    Need to know more to help you.
     
    unispace, Dec 6, 2006 IP
  3. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #3
    It's a UNIX server
     
    redhits, Dec 6, 2006 IP
  4. unispace

    unispace Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I should said to be a little more specific: FreeBSD?, Fedora?, etc...

    It depends because file structures and confs are different.
     
    unispace, Dec 6, 2006 IP
  5. chrisranjana.com

    chrisranjana.com Active Member

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Assuming your php scripts use CURL for crawling ..You can specify

    curl --interface XXX.XXX.XXX.XXX
     
    chrisranjana.com, Dec 6, 2006 IP
  6. unispace

    unispace Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yup, could do that too.
    Probably much easier then what I was going to try.
     
    unispace, Dec 7, 2006 IP