Results 1 to 4 of 4

Thread: [RESOLVED] cURL problem

  1. #1
    Lively Member
    Join Date
    Mar 12
    Posts
    66

    Resolved [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.

  2. #2
    Lively Member
    Join Date
    Mar 12
    Posts
    66

    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.

  3. #3
    Fanatic Member
    Join Date
    Sep 05
    Posts
    521

    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($thePageObjCURLOPT_URL$modemIP $modemPage);  
      
    curl_setopt($thePageObjCURLOPT_USERPWD$modemUsername ":" $modemPassword);
      
    curl_setopt($thePageObjCURLOPT_RETURNTRANSFERTRUE);
      
    $thePage curl_exec($thePageObj);
      
      return 
    $thePage;
      

    Take it, with a little modification, it will help you on your quest.

  4. #4
    Lively Member
    Join Date
    Mar 12
    Posts
    66

    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
  •