I'm trying to use this API: www.cpsc.gov/cpscpub/prerel/api.html
Documentation: www.cpsc.gov/cpscpub/prerel/requirements.pdf
Here is the location calls are to be sent, which also includes sample code snippets: http://www.cpsc.gov/cgibin/CPSCUpcWS/CPSCUpcSvc.asmx
The getRecallByWord function should return XML data.
Here's a preformed URL for getting the data (note, have to use https according to doc): www.cpsc.gov/cgibin/CPSCUpcWS/CPSCUpcSvc.asmx/getRecallByWord?message1=3M&password=password&userId=userId
In the documentation there is a note that no specific username or password is required (anything will work)
I've tried fopen, file_get_contents, and http_get (although the last one didn't work since extension isn't installed).
$result = fopen("https://www.cpsc.gov/cgibin/CPSCUpcWS/CPSCUpcSvc.asmx/getRecallByWord?message1=3M&password=password&userID=userId",r);
print $result;
print "done";
$response = file_get_contents("https://www.cpsc.gov/cgibin/CPSCUpcWS/CPSCUpcSvc.asmx/getRecallByWord?message1=3M&password=password&userID=userId");
print $response;
print "done";
Output:
Resource id #3done done
allow_url_fopen is On