Quote:
Originally Posted by mramsey
Correct me if I'm wrong but SOAP is installed because it connects to sandbox right?
Also, i'm not sure what you want me to print_r?
Here's the code:
PHP Code:
<form enctype="multipart/form-data" method="POST"> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php $target="uploads/"; $target=$target.basename($_FILES['uploaded']['name']); if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { $fp=fopen($target,'r'); $k=0; require_once ('soapclient/SforcePartnerClient.php'); $mySforceConnection = new SforcePartnerClient(); $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml"); $mylogin = $mySforceConnection->login("user@domain.com", "password"); while(!feof($fp)) { $line=fgets($fp); if($line==''){continue;} $line = explode("\t",str_replace('&', '&', $line)); $id[$k]['id']=$line[0]; $id[$k]['name']=str_replace('"','',$line[1]); $k++; } foreach($id as $creditorid) { $query="SELECT Creditor_Id__c from Creditor__c where Creditor_Id__c='".$creditorid['id']."'"; $queryResult = $mySforceConnection->query($query); $records= $queryResult->records; if(count($records)<1){ $fieldsToInsert = array('Name'=>$creditorid['name'],'Creditor_Id__c'=>$creditorid['id']); print_r($fieldsToInsert); echo "<br />"; $sObject = new SObject(); $sObject->fields = $fieldsToInsert; $sObject->type = 'Creditor__c'; $lead = $mySforceConnection->create(array ($sObject),'Creditor__c'); }else{echo "Skipped<br />";continue;} }}
The error is :
PHP Fatal error: Uncaught SoapFault exception: [ns1:INVALID_LOGIN] INVALID_LOGIN: Invalid username or password or locked out. in /var/www/html/sf/soapclient/SforceBaseClient.php:113\nStack trace:\n#0 [internal function]: SoapClient->__call('login', Array)\n#1 /var/www/html/sf/soapclient/SforceBaseClient.php(113): SoapClient->login(Array)\n#2 /var/www/html/sf/script.php(16): SforceBaseClient->login(user@domain.com', 'password')\n#3 {main}\n thrown in /var/www/html/sf/soapclient/SforceBaseClient.php on line 113, referer:
|
Ahh I missed that man, sorry I did not know that you are getting logged into your sandbox okay!!! My mistake
I wanted you to print_r that error message that you just posted, Ha!
listen Try this
PHP Code:
<?php
$user = 'user@domain.com';
$pass = 'password';
/* this is the key that I generated from my development account
* which allows you to bipass the IP check in Salesforce
* go to salesforce > My personal Information > Reset my security Token*/
$pass_string = 'L07opnWnbTKrvJ3wcpFiWyTsl';
$pass = $pass.$pass_string;
require_once ('soapclient/SforcePartnerClient.php');
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
$mylogin = $mySforceConnection->login($user, $pass);
if ($mylogin)
{
echo "logged in";
}
else
{
echo "crap, something is wrong";
}
?>
let me know if this makes sense or if this is completely idiotic!!
~Mike