Jump to content

Help with sending info to remote server using PHP?


galvin

Recommended Posts

I have this XML...

$xml = '<?xml version="1.0" encoding="utf-8"?>' .
       '<LeadImportDatagram>'.
           '<CompanyKey>' . $companyKey . '</CompanyKey>' .
           '<NotificationEmailTo>garysaldutti@gmail.com</NotificationEmailTo>' .
           '<LeadInfo>';
           '<City>Osweeego</City>';
          '</LeadInfo>' .
        '</LeadImportDatagram>';

 

and I need to use PHP to submit that XML to a remote server at a address in this format (http://XX.XXX.XXX.XXX/xml/importlead.asp) so that the remote server can process the info.

 

Can anyone out there tell me how to do that?  It seems like I have to use cURL and I've tried multiple times but keep getting "bad request" errors.

 

SIDE NOTE: Is my syntax wrong?  Someone else helped me write that $xml variable, but it seems weird to me that some lines end with periods and some end with semicolons.

 

 

Link to comment
Share on other sites

lol is your syntax wrong? Just a lil try:

 

$xml = '<?xml version="1.0" encoding="utf-8"?>' .
       '<LeadImportDatagram>'.
           '<CompanyKey>' . $companyKey . '</CompanyKey>' .
           '<NotificationEmailTo>garysaldutti@gmail.com</NotificationEmailTo>' .
           '<LeadInfo>'.
           '<City>Osweeego</City>'.
          '</LeadInfo>' .
        '</LeadImportDatagram>';

Link to comment
Share on other sites

Figured as much, but that still isn't the issue.  I fixed the syntax and still get the same "bad request" errors.  If anyone can explain how to put together the cURL code using the info I provided, I would GREATLY appreciate it.

Thanks,

Link to comment
Share on other sites

May not be understanding what you're asking, but I am not extracting any info from the remote server address, I am just sending info to that server and it will process the info on their end.  I am just trying to figure out the code to simply send my XML to this remote address.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.