dlebowski Posted October 17, 2014 Share Posted October 17, 2014 $account="54646456456464"; $station= "12345"; $options="11-1"; $image="C:/Desktop/Sample Images/usco1.jpg"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://dfdgfsfs.com/kgdfgd.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image' => '@'.$image, 'account' => $account, 'station' => $station, 'options' => $options)); $postResult = curl_exec($ch); curl_close ($ch); $xmlobj = simplexml_load_string($postResult); echo (string)$xmlobj->ID->attributes()->value; echo (string)$xmlobj->FullName->attributes()->value; All, I have spend days trying to figure this out without any luck. I am now in crisis mode. I need to get this working asap. The following code works perfect on my local xampp machine. As soon as I upload it to my web server, I don't get any data back. I have narrowed it down to the image i am trying to send is not being received properly. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/291891-curl-image-upload-works-on-local-xampp-but-not-web-server/ Share on other sites More sharing options...
Solution Ch0cu3r Posted October 17, 2014 Solution Share Posted October 17, 2014 (edited) The following is local file path for your PC and not the server $image="C:/Desktop/Sample Images/usco1.jpg"; usco1.jpg needs to be located on the server you are running the code from. PHP cannot access remote users file systems. Edited October 17, 2014 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/291891-curl-image-upload-works-on-local-xampp-but-not-web-server/#findComment-1494018 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.