textbox Posted May 9, 2007 Share Posted May 9, 2007 Hello, i wish to process a form automatically using curl. I have tried a few tutorials, but to no avail, any help would be great. The form code is below. <form action="http://heywatch.com/upload" enctype="multipart/form-data" method="post" > <input type="hidden" value="f60d0e2674709ce68f597ce89ded1bb0" name="key" /> <input type="hidden" value="http://yoursite.com/upload_success.php" name="redirect_if_success" /> <input type="hidden" value="http://yoursite.com/upload_error.php" name="redirect_if_error" /> <input type="hidden" value="20" name="your_site_user_id" /> <input type="hidden" value="1540" name="post_id" /> <p><input id="data" name="data" type="file" /></p> <p><input name="commit" type="submit" value="Upload" /></p> </form> Thanks nick Link to comment https://forums.phpfreaks.com/topic/50731-curl-help/ Share on other sites More sharing options...
Ninjakreborn Posted May 9, 2007 Share Posted May 9, 2007 It wouldn't be fair for us to "program" it for you. http://www.google.com/search?hl=en&q=basic+curl+tutorial&btnG=Google+Search Since you are looking for something pretty basic "with" curl. I can understand it can get frustrating dealing with, because there are hardly any tutorials out there for it. I mean w3schools.com doesn't even have a part on that yet. Look around for some tutorial's, work up a rough bit of code and then let us help you to make sense of it and make it work. Link to comment https://forums.phpfreaks.com/topic/50731-curl-help/#findComment-249398 Share on other sites More sharing options...
textbox Posted May 9, 2007 Author Share Posted May 9, 2007 Ok, thanks for that. curl -d "data=$original_url&key=f60d0e2674709ce68f597ce89ded1bb0&press=%20OK%20" http:/heywatch.com/upload This is what i have so far. Do i need to initiate curl at all, or anything similar? Thanks Link to comment https://forums.phpfreaks.com/topic/50731-curl-help/#findComment-249406 Share on other sites More sharing options...
textbox Posted May 10, 2007 Author Share Posted May 10, 2007 Right, this is what im using now. $url = "http://heywatch.com/discover"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,0); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS,"url-field=$fileName&key=f60d0e2674709ce68f597ce89ded1bb0"); // add POST fields $chresult = curl_exec($ch); // run the whole process curl_close($ch); echo $chresult; Basically, i am trying to get a file URL posted into this API. The form i have posted above is for an upload, can a URL be put into an upload field form?! Any help on this would be great! Nick Link to comment https://forums.phpfreaks.com/topic/50731-curl-help/#findComment-249430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.