Jump to content

awi

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

awi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi again, I posted a msg earlier regarding the same problem but this time I'm going to try CURL instead of fsockopen (giving up for now). Ok, so I'm trying to POST some data including a file (as if you are sending a multi-part html form) using curl. Here is what I'm trying to run: $fileToSend = join("", file($file)); // $file is name of file and it resides in same dir as this script $postfields = array( 'clip.category' => $someCatId, 'clip.tags' => $someTag, 'clip.title' => $title, 'clip.description' => $desc, 'clip.language' => 'en', 'clip.file' => "@$fileToSend"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $res); curl_setopt($ch, CURLOPT_FAILONERROR, 1); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "$postfields"); // execute curl command $result = curl_exec($ch); print '<pre>'; print_r($result); exit; My $result is empty, I get a blank page. 1) Do you see anything wrong with my code? 2) I do not have access to the "receving" end of this. How ould you diagnose problems without that kind of access. Thanks again for your help CA
  2. Thanks in advance for attempting to help! I have a php processor script that loops through an xml doc, extracts video data (names, file names...etc) and does a bunch of other stuff. Within this loop I need to have the script perform a "POST" basically emulating an HTML form but ofcourse in this case I do not want any HTML. I understand there are (mainly) 2 options to do this: fsockopen and curl. I would like to use fsockopen if possible, so I can get an http response code and hopefully analyze it when applicable. I have tried to do this using fsockopen for a little over a day now with no success. I've read various posts and tutorials, but with no success so far. I know I could be missing something simple or maybe complex, I do not know any more, I'm going crazy with this Can you please give me some guidance on how to send a POST using fsockopen for this situation: lets say I want to send 3 pieces of data: clipTitle='Funny Clip', clipDescr='this is some descr', clipCategory='humor' and I want to send (as if i'm uploading a file) file='1234.mpg' this file resides in the same dir as the script running this fsockopen. I followed an example such as this one (modified for my situation) but no success: http://www.thescripts.com/forum/thread588770.html Thanks again! CA
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.