Reply to Re: Obstacles using PHP to send POST to a remote site

Your name:

Reply:


Posted by ZeldorBlat on 10/12/43 11:38

Nathan wrote:
> Hi there, hope you can help me.
>
> Someone has a bunch of these routers and they each have a standard HTML
> web-interface.
>
> Because there are several over different locations they want to be able
> to have a central web interface that can 'talk' to the routers and change
> certain features on several routers at once. Because the routers offer
> no alternative for configuration (like telnet) the idea is that I build
> something to get a PHP script to pretend to be a browser.
>
> I have the principles down of actually getting PHP to post to a webpage:
> I can do a basic authorisation thing (i.e. like .htaccess) to get round
> the login part and send post variables using fsockopen. I've tested this
> with my own 'pretend' form interface and can get it to work (I can see
> that info has been posted and written to the DB etc).
>
> Then I try this with the router's actual interface using the same method,
> and get the intended form variables by analysing the source of the HTML
> to get the input field names, etc.
>
> But it doesn't work. Obviously without knowing the router's source code
> for its little internal webserver thingy it's hard to know where it's
> going wrong, so I was just wondering if you had any thoughts as to what
> sort of things may be stopping it. I suppose maybe it could have
> something to do with sessions or something - so is there a way to 'see'
> what's going on between Firefox and the web-server so I might find out
> how to spoof this via a PHP script? I thought it might have something to
> do with posting to a page which then has a refresh thing that posts to a
> second page, and because of the way it works in my script, it doesn't go
> to this second page, but I can't really tell if this is happening simply
> by looking in my browser.
>
> I'm this close to telling them it can't be done, but I thought I'd see if
> there's something obvious I'm missing, because I'm a bit new to this
> fsockopen business.
>
> Thanks. Any help really appreciated.
>
> --
> Nathan.
> Bow to the Cow!

Two thoughts: first, use the cURL functions if you can rather than
fsockopen. It will give you a lot more flexibility and take care of
some of the finer things for you (like cookies and such). Second, you
can see what's happening between the browser and server using a
packet-sniffing tool like Ethereal.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация