vsloathe

Is it possible to pass an object handle via POST? I've read somewhere that you can use serialize() and unserialize(), but that doesn't seem to be working with the cURL object handle that I want passed in when I POST a script to itself.

perkiset

I'm confused V - POST is a plain text format. The only thing that you could do is serialize an object and then pass it in a multi-part format... but a handle is a pointer to a live object in memory, so passing a handle would be meaningless...

perhaps if we knew more about what about you are trying to accomplish...

vsloathe

I'm trying to accomplish being lazy.

Actually, I could probably do it better with

AJAX

 , but here's a basic outline:

1. grab a username/pass from my database of accounts
2. login
3. go to the page to upload a file (which you must be logged in to do)
4. grab the captcha image and dynamic elements (hashes)
5. await for a user (or in my case, another program I wrote) to give the captcha answer
6. POST the captcha answer + file to upload, etc.

Now, the way I do step 5 is just with a simple form, so right now there's no way for me to pass the web browser object I'm using on to the next step.

vsloathe

I guess basically I want to be able to take input from the user without losing my session stuff. I just don't want to have to store all the session specific stuff and reload it.

DangerMouse

Wow - just looked this up being a

PHP

  noob - very cool! Passing objects between domains (that share the same library) sounds very useful  Applause

My reading of the manual suggests that passing an object as you suggest would be just like posting a file to a site, if not cross domain maybe a cache or session could be used? Sorry I can't be more help, don't really know what im talking about just found the post interesting.

DM

nop_90

this not for

php

 , but it universal.
find a serialization library. so you could use json.
serialize and unserialize the object.

json probably best since u can control security better, and also you could theoretically pass objects back and forth between languages even.
not sure how serialize/unserialize in

PHP

  works, but in most language u have to problem it has to match language versions.
Also in some cases it actually freezes the bytecode.
This opens up all sorts of fun things to do Applause

perkiset

JSON is excellent if you need to go cross-language, but if you're

PHP

  to

PHP

  then serialize() is better because it handles

PHP

  types better. In either case, Nop is correct and this is rather a standard model for moving complex objects between systems.


Perkiset's Place Home   Politics @ Perkiset's