Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

curl and php

Status
Not open for further replies.

lonelydragon

Programmer
Aug 5, 2004
75
US
hi, everyone:
i have a problem on my project.
i am tring to write a code on the server to retrieve data(file) that customer sent via Curl. my code is on the server side. but i don't know how to retrieve the data(file). thank you for your help.

the code on that customer si sending...
$ch = curl_init("
$fp = fopen('xml_a.xml','r');
while (!feof($fp)){
$xmlContent .= fread($fp,4096);
}

$xmlContent = "nannan";
$url = "
curl_setopt($ch, CURLOPT_HTTPHEADER,array("Content-type: text/xml"));
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4); // times out after 4s
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlContent);
$result = curl_exec($ch) or die($xmlContent);
 

$fp = fopen('xml_a.xml','r');

!!!!!!!!!!!!!!!!!!put a check here for any errors
while (!feof($fp)){
$xmlContent .= fread($fp,4096);
}
!!!!!!!!!!!!!!!!!!! here you just wiped out what was read in assuming fopen was successful.

$xmlContent = "nannan";
 
thank you for you reply.
then how to retrieve the $xmlContent in the server?
by the way, "$xmlContent = "nannan";" in the code is redundant amd useless.
thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top