/    Sign up×
Community /Pin to ProfileBookmark

Hi guys,

I want to post a form through Curl. But I am getting some errors.
See [url]http://stage.sigmatec.com.pk/schoolfocus/kodak.html[/url]
This is a Form that post data to a URL. In result You will see some XML output.

I am trying to post same data using Curl but getting Page not Found error. Why is this? See my code below.

[code=php]$url = “https://secure.xmi.stagep.kodakgallery.com/servlet/XMIDispatchServlet/servlet/XMIDispatchServlet/”;
$xml_string='<?xml version=”1.0″ encoding=”UTF-8″?>
<partner_login action=”ofoto_login” version=”3.0″>
<sourceid>’.$this->source_id.'</sourceid>
<userid>’.$this->user_name.'</userid>
<password>’.$this->user_password.'</password>
</partner_login>’;

$post_data = “ofoto_xml=” . $xml_string;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

$headers[] = “Content-Type: multipart/form-data”;
$headers[] = “Content-Length: ” . strlen($post_data);
$headers[] = “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15”;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$data = curl_exec($ch);
curl_close($ch);
echo($data);[/code]

Can you help in finding out, what’s wrong in code???

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@opifexSep 12.2009 — Does your server support XForms????
Copy linkTweet thisAlerts:
@toicontienSep 14.2009 — You might want:
[CODE]$post_data = "ofoto_xml=" . [B]rawurlencode( $xml_string )[/B];[/CODE]
×

Success!

Help @mrizwan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...