|
-
Jun 12th, 2012, 04:08 AM
#1
Thread Starter
Lively Member
[RESOLVED] cURL problem
I don't exactly know how to describe this, but I am trying to replicate a POST a program does.
I made a scrshot to best describe it (wireshark):

A normal postfields array in cURL would look like this:
Code:
$params = array(
'sess_id' => $password,
'filename' => $pure_name,
'file_0'=>"@{$filename}"
);
But the problem is that if I separate the two values "filename" and "file_0", filename doesn't get read by the site I am posting to.
How do I replicate the section on the screenshot above? 
First I thought that file_0 may be an associative array like this:
Code:
$file_0 = array('filename' => $pure_name, 'something' => "@{$filename}");
But as you can see, I didn't know what to put as name for the file since I can't find it anywhere in wireshark.
Please, any cURL junkie out there want to give me a hand? 
EDIT:
For those that doesn't understand the wireshark pic, here is the section in text, copied from Chrome:
Code:
------WebKitFormBoundaryi5jMYnSHf5meHO6m
Content-Disposition: form-data; name="file_0"; filename="01.bmp"
Content-Type: image/bmp
Last edited by toxicious; Jun 12th, 2012 at 04:14 AM.
-
Jun 12th, 2012, 04:27 AM
#2
Thread Starter
Lively Member
Re: cURL problem
EDIT: I screwed up. The code just trolled me, it didn't work. Back at square one. (Damnit can't remove the "RESOLVED" tag either). So...any clues?
Last edited by toxicious; Jun 12th, 2012 at 04:35 AM.
-
Jun 12th, 2012, 06:22 AM
#3
Fanatic Member
Re: [RESOLVED] cURL problem
Here's something I use to pull stuff from my modem:
PHP Code:
//Different ways to get webpages/files. Bothn allow for GET and POST. I suggest you use CURL though if you want to use POST. Here's some basic examples of both:
function getPage($modemUsername, $modemPassword, $modemIP, $modemPage) { $thePageObj = curl_init(); curl_setopt($thePageObj, CURLOPT_URL, $modemIP . $modemPage); curl_setopt($thePageObj, CURLOPT_USERPWD, $modemUsername . ":" . $modemPassword); curl_setopt($thePageObj, CURLOPT_RETURNTRANSFER, TRUE); $thePage = curl_exec($thePageObj); return $thePage; }
Take it, with a little modification, it will help you on your quest.
-
Jun 12th, 2012, 06:52 AM
#4
Thread Starter
Lively Member
Re: [RESOLVED] cURL problem
Hmm sorry but I can't see the clue?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|