You are here: Re: PHP, cURL, and File Uploads « PHP Programming Language « IT news, forums, messages
Re: PHP, cURL, and File Uploads

Posted by HC on 06/12/06 21:13

Hi Sjoerd,

Your example runs, but 'foo' and 'beer' seem to be standard form inputs
- they don't appear to simulate a file upload. The script I am
submitting to looks for data from $_FILES - unfortunately, I have no
control over this.

If you have any other ideas, that would be spectacular.

HC



Sjoerd wrote:
> <?php
>
> $post_data = array();
>
> $post_data['foo'] = "bar";
> $post_data['beer'] = "good";
>
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, "http://my.domain.com/my_url.php" );
> curl_setopt($ch, CURLOPT_POST, 1 );
> curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> $postResult = curl_exec($ch);
>
> if (curl_errno($ch)) {
> print curl_error($ch);
> }
> curl_close($ch);
> print "$postResult";
> ?>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация