The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 11:17:46 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Question regarding POST and objects  (Read 3062 times)
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« on: November 21, 2007, 12:33:07 PM »

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.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: November 21, 2007, 01:35:25 PM »

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...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #2 on: November 21, 2007, 02:19:14 PM »

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.
Logged

hai
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #3 on: November 21, 2007, 02:21:33 PM »

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.
Logged

hai
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #4 on: November 21, 2007, 02:27:31 PM »

Wow - just looked this up being a PHP noob - very cool! Passing objects between domains (that share the same library) sounds very useful  Smiley

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
Logged
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #5 on: January 01, 2008, 06:32:29 PM »

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 Cheesy
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: January 02, 2008, 10:08:49 AM »

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.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!