mo Posted December 11, 2008 Share Posted December 11, 2008 I signed up for an efax accont and I am currently trying to send a outbound text fax. I have the following directions but I am unsure how to proceed. I have written code to format my XML message but do not know how to send the request. I have completed the items in blue but I am stuck on the items in red. I am a PHP newbee. Instructions: The following is provided as a high-level overview of expected client-side outbound request processing. • Open a TCP/IP socket or URL connection using the URL address for eFax Developer™. The secure eFax Developer™ URL is https://secure.efaxdeveloper.com/EFax_WebFax.serv. • Set the request header section to specify the HTTP POST method, set the Content-type to be “application/x-www-form-urlencoded.” • Create an XML-formatted message meeting all requirements as explained in this document. • URL-encode the XML-formatted message. • Send your request to eFax Developer™. To send a request, an application writes a stream of data to eFax Developer™ via a TCP/IP socket or URL connection. The data stream must be in the form of an HTTP POST request message. The request will consist of two arguments, an Account Identifier (“id”); provided at setup time; and your XML-formatted data (“xml”). Optionally, you may send a third argument to indicate the desired response type (“respond”) of “HTML” (default) or “XML.” Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/ Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 $xml = your xml string $id = your account id $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'https://secure.efaxdeveloper.com/EFax_WebFax.serv'); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,array('id'=>$id,'xml'=>$xml)); curl_exec($ch); Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712793 Share on other sites More sharing options...
mo Posted December 11, 2008 Author Share Posted December 11, 2008 Thank you for your reply. It partially worked. I got an error message (below) but at lease the communication worked. Thanks. Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712872 Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 i don't see an error message Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712893 Share on other sites More sharing options...
mo Posted December 11, 2008 Author Share Posted December 11, 2008 Below: Post Unsuccessful! Your request has failed due to invalid data. Please refer to our documentation prior to resubmitting. Error Level: User Error Message: Account identifier argument was not passed. Please contact us at 888-278-8666 if you continue to encounter errors. Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712914 Share on other sites More sharing options...
premiso Posted December 11, 2008 Share Posted December 11, 2008 curl_setopt($ch,CURLOPT_POSTFIELDS,array('id'=>$id,'xml'=>$xml)); Where is $id being set? Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712930 Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 Below: Post Unsuccessful! Your request has failed due to invalid data. Please refer to our documentation prior to resubmitting. Error Level: User Error Message: Account identifier argument was not passed. Please contact us at 888-278-8666 if you continue to encounter errors. did you set $id to your account id? Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712946 Share on other sites More sharing options...
mo Posted December 11, 2008 Author Share Posted December 11, 2008 Yes, I set the ID variable before I call your code. curl_setopt($ch,CURLOPT_POSTFIELDS,array('id'=>$id,'xml'=>$xml)); I changed the CURLOPT_POSTFIELDS to use a string for fields, i.e. $fields = 'id='.$id.'&xml='.$xml; and this worked but I still received an erorr but I think I can fix this. I now receive Error Message: File contents are not Base64 encoded. I just changed urlencode to base64_encode for my XML string and I now recieve error "XML data argument was not passed.". Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712956 Share on other sites More sharing options...
premiso Posted December 11, 2008 Share Posted December 11, 2008 curl_setopt($ch,CURLOPT_POSTFIELDS,array('id'=>$id,'xml'=>$xml)); That is not setting the id, where do you actually define $id = "your code" ? Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712961 Share on other sites More sharing options...
mo Posted December 11, 2008 Author Share Posted December 11, 2008 Here is my code: $id = '6785555555'; $xml = order_to_fax('5',$id); $fields = 'id='.$id.'&xml='.base64_encode($xml); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'https://secure.efaxdeveloper.com/EFax_WebFax.serv'); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields); curl_exec($ch); Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-712970 Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 what does order_to_fax('5',$id); do? Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-713025 Share on other sites More sharing options...
mo Posted December 11, 2008 Author Share Posted December 11, 2008 it builds an XML string based on a order in my database. I checkd the XML and the structure/format looks good. I think the error is due to Curl not handling the XL properly. I am looking at some post on other sites and I see alot of people have issues posting XML with curl. Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-713071 Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 have you looked at this site yet? http://www.m2osw.com/efax_docs/ Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-713171 Share on other sites More sharing options...
mo Posted December 12, 2008 Author Share Posted December 12, 2008 Yup. I'm just gonna buy their script. I was trying to avoid this but I need to get my software finished and this is the last hurdle. Thanks for all your help. Link to comment https://forums.phpfreaks.com/topic/136552-help-with-php-request-to-efax-development-server/#findComment-713246 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.