-
-
Save kandy/dd6592508c5774d9235d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: akasian | |
* Date: 10/6/15 | |
* Time: 9:45 AM | |
*/ | |
ini_set('display_errors',1); | |
$token = "67ihe78il86214jgt8asjr9fhvl9i41r"; | |
$baseUrl = 'http://mage.dev/rest/'; | |
for ($i = 1; $i <= 10; $i ++) { | |
$postdata = json_encode([ | |
"customer" => [ | |
"email" => "user{$i}@example.com", | |
"firstname" => "John", | |
"lastname" => "Doe", | |
"addresses" => [ | |
[ | |
"defaultShipping" => true, | |
"defaultBilling" => true, | |
"firstname" => "John", | |
"lastname" => "Doe", | |
"region" => [ | |
"regionCode" => "CA", | |
"region" => "California", | |
"regionId" => 12 | |
], | |
"postcode" => "90001", | |
"street" => ["Zoe Ave"], | |
"city" => "Los Angeles", | |
"telephone" => "555-000-00-00", | |
"countryId" => "US" | |
] | |
] | |
] | |
]); | |
$opts = ['http' => [ | |
'method' => 'POST', | |
'header' => implode("\n", [ | |
"Authorization: Bearer " . $token, | |
'Content-type: application/json' | |
]), | |
'content' => $postdata | |
]]; | |
$context = stream_context_create($opts); | |
var_dump(file_get_contents( $baseUrl . 'default/V1/customers/', null, $context)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kandy, Please find the first image which i'm able to get xml request by giving the url http://192.168.0.183/magento1131/api/v2_soap/?wsdl=1 in magento1
Observe the second image throwing error after giving the URL http://192.168.0.183/NewMagento2/soap?wsdl&services=customerCustomerRepositoryV1 to get the xml request in magento2