Connect to Bing Merchant Center using phpseclib - php

I'm trying to use phpseclib in my project to upload a product feed to Bing's Merchant Center using SFTP. I'm using phpseclib in the same project to upload a product feed to Amazon via SFTP, and it's working correctly, but I can't seem to connect successfully to Bing.
The following code is attempting to connect to Bring:
$sftp = new Net_SFTP(BING_FTP_SERVER);
if (!$sftp->login(BING_FTP_USERNAME, BING_FTP_PASSWORD)) {
exit('Login Failed');
}
When I run this code, there is about a 10 second delay, and then I get an error saying the login failed and:
Cannot connect to feeds.adcenter.microsoft.com. Error 110. Connection timed out
To test the credentials, I connected manually using Filezilla, and it works correctly. However, before connecting, Filezilla shows me a warning saying the server's certificate is unknown and I need to manually approve it before I can connect. When I use Filezilla to connect direclty to Amazon's FTP server, I do NOT receive this warning.
So, I'm wondering if it's possible this warning is causing the issue. Do I need to somehow tell my Ubunut server to trust the certificate on Bing's FTP server, basically mimicking the manual approval I was required to give in Filezilla? Does anyone know how to do this?

According to Bing merchant FAQ, only the FTP or the FTPS is supported. Not the SFTP. The phpseclib supports the SFTP only. The FTPS and SFTP are completely different protocols.
Refer to PHP manual for its FTP functions:
https://www.php.net/manual/en/book.ftp.php

Related

Can't ftp to azure webapp

I've created simple webapp + mysql database on azure and i've set ftp username/pass. I'm following this article:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-mysql-deploy-use-ftp/
Everything is fine up to the ftp part, i just can't connect to that ftp. I tried using the username/pass i set in Deployment Credentials. I tried using the username/pass i see in the PublishSettings file, but nothing is working.
I tried via linux ftp cmd and filezila and played with active/passive.
When i telnet ip 21 i'm getting timeout too.
Could someone please explain how to connect to that azure ftp?
Thanks
One common problem is that you need to have the username look like YourSiteName\YourUserName and not just YourUserName.
If you look under 'FTP/Deployment username' in the Azure portal, it gives the correct name with the site name prefix.
According to the offical documents, the section Deploy by copying files to Azure manually of the doc Deploy your app to Azure App Service introduce the steps of deploying the WebApp via FTP.
The key point of deploying via FTP on Azure is the FTP connection information, you can follow the steps 5 to 7 of the section Get MySQL and FTP connection information of the doc Create a PHP-MySQL web app in Azure App Service and deploy using FTP to find them from the .publishsettings file got on the Azure new portal, please see the picture below.
The method shown in the tutorial you link to is how I do it when I need to lookup my azure credentials - by downloading the Publish Profile and pulling the information out of there.
Here's how I do it:
using FileZilla (https://filezilla-project.org/) I plug the publishurl in the host field, leave the port blank, select FTP - File Transfer Protocol, use explicit FTP over TLS if available, Logon Type: Normal, enter userName in the user field, userPWD in the password field.
Click Connect and the FTP connection is made (after I click the security msg).
So it's a plain old FTP connection. There's nothing special going on.
If this isn't working for you I would suggest the problem isn't with your credentials, check the webapp has been started in azure, check you can ftp with another site\server.
Good luck. Hope this helps.

FTP Connect Error

I'm trying to connect to my FTP site via PHP with the standard PHP function:
http://www.php.net/manual/en/function.ftp-login.php>
But it won't connect. I can log onto the server through a program and explorer though. Is there something in my server I have to change or something?
It's a little hard to tell without either the code or the error message but, yes, you do have to have an FTP server running, something many systems don't turn on by default.
Being able to log in and attach via via Explorer use different capabilities, not necessarily related to the FTP ports. Logging on would use the telnet port while Explorer would most likely use SMB/CIFS.

PHP: Could not connect to host. Howto add external certificate to trusted using OpenSSL?

My college downloaded cert-name.crt file from external host. Now we need to connect to web service platform, obviously using their SSL certificate. We are a bit confused by OpenSSL documentation. Research didn't help either. All we get is 'Could not connect to host' PHP exception. Just to clear things, interface worked perfectly fine over unsecured HTTP. We use pure Soap library. As an act of desperation we also tried to connect with host without verification by disabling verify_peer variable in SoapClient stream context. Please help, we are under pressure.
To get your started:
By default, PHP looks for the CA file on UNIX systems in, make sure it is readable by the PHP invoker (user via cli, Apache user, etc..), and place the .crt file here:
/etc/pki/CA

PHP Netbeans, Cannot Connect to server via SFTP

Im trying to connect my project via sFTP. and everytime I run the project it says.
Cannot Connect to Server http://abcd.efg.com
Reason: java.net.UnkownHostException: http://abcd.efg.com
But when I hit ok. the application then starts at my browser. which is weird, I set up the project as New Project, and PHP Application with existing Sources because I already have a project. then set "Run as: remote website (ftp,Sftp)"
use abcd.efg.com instead of http://abcd.efg.com
you cannot connect over sftp and http at the same time :).
Netbeans is expecting the hostname to connect over sftp, surely it doesnt like http://hostname.com over :22

SFTP listing directory

I'm trying to make a connection to a secure sftp site, however I'm not able to list the directory,however, it's possible to connect using python "expect" or php"ssh2_connect" but it gives me the following mesg: Received disconnect from xx.xx.xx.
If I use a GUI appliction like winscp I'm able to go to the sftp server and retrieve files.
I need to script it thus a cli interface is needed.
PS: just in case someone ran into this. I'm trying to connect to Avisena.com sftp server
You can do this easily with paramiko, checkout SFTP with Python

Categories